Пример #1
0
def test_type():
    l = Lists()
    v1 = ['a', 'b', 5]
    l.validate(v1)

    v2 = 234
    with pytest.raises(TypeError):
        l.validate(v2)
Пример #2
0
def test_elt_vals():
    l = Lists(Ints(max_value=10))
    v1 = [0, 1, 5]
    l.validate(v1)

    v2 = [0, 1, 11]
    with pytest.raises(ValueError):
        l.validate(v2)
Пример #3
0
    def test_elt_vals(self):
        l = Lists(Ints(max_value=10))
        v1 = [0, 1, 5]
        l.validate(v1)

        v2 = [0, 1, 11]
        with self.assertRaises(ValueError):
            l.validate(v2)
Пример #4
0
    def test_type(self):
        l = Lists()
        v1 = ['a', 'b', 5]
        l.validate(v1)

        v2 = 234
        with self.assertRaises(TypeError):
            l.validate(v2)
Пример #5
0
def test_valid_values():
    val = Lists(Ints(max_value=10))
    for vval in val.valid_values:
        val.validate(vval)
Пример #6
0
 def test_valid_values(self):
     l = Lists(Ints(max_value=10))
     l.validate(l.valid_values[0])