Пример #1
0
 def test_close_to_ints(self):
     validator = PermissiveInts()
     a = 0
     b = 10
     values = np.linspace(a, b, b - a + 1)
     for i in values:
         validator.validate(i)
Пример #2
0
    def test_bad_values(self):
        validator = PermissiveInts(0, 10)
        validator.validate(validator.valid_values[0])

        a = 0
        b = 10
        values = np.linspace(a, b, b - a + 2)
        for j, i in enumerate(values):
            if j == 0 or j == 11:
                validator.validate(i)
            else:
                with self.assertRaises(TypeError):
                    validator.validate(i)
Пример #3
0
 def test_valid_values(self):
     val = PermissiveInts()
     for vval in val.valid_values:
         val.validate(vval)