Пример #1
0
 def test_length_raises_if_length_does_not_match_in_list(self):
     l_code = SimpleCode(l_code=[1, 2, 3, 4, 5, 0])
     with self.assertRaises(ValidationException):
         l_code.validate()
     l_code = SimpleCode(l_code=[1, 2])
     with self.assertRaises(ValidationException):
         l_code.validate()
Пример #2
0
 def test_maxlength_raises_if_length_is_greater_than_types_maxlength_in_list(self):
     tl_max_code = SimpleCode(tl_max_code=[1, 2, 3, 4, 5, 6, 7, 8, 9, 0])
     with self.assertRaises(ValidationException):
         tl_max_code.validate()
     tl_max_code = SimpleCode(tl_max_code=[1, 2, 3, 4, 5, 6, 7, 8, 9])
     with self.assertRaises(ValidationException):
         tl_max_code.validate()
Пример #3
0
 def test_length_raises_if_length_does_not_match_in_str(self):
     code = SimpleCode(code='12345')
     with self.assertRaises(ValidationException):
         code.validate()
     code = SimpleCode(code='1')
     with self.assertRaises(ValidationException):
         code.validate()
Пример #4
0
 def test_maxlength_raises_if_length_is_greater_than_types_maxlength_in_str(self):
     t_max_code = SimpleCode(t_max_code='1234556932598236')
     with self.assertRaises(ValidationException):
         t_max_code.validate()
     t_max_code = SimpleCode(t_max_code='147432348')
     with self.assertRaises(ValidationException):
         t_max_code.validate()
Пример #5
0
 def test_minlength_raises_if_length_is_less_than_types_minlength_in_list(
         self):
     tl_min_code = SimpleCode(tl_min_code=[1, 2, 3])
     with self.assertRaises(ValidationException):
         tl_min_code.validate()
     tl_min_code = SimpleCode(tl_min_code=[1])
     with self.assertRaises(ValidationException):
         tl_min_code.validate()
Пример #6
0
 def test_minlength_raises_if_length_is_less_than_types_minlength_in_str(
         self):
     t_min_code = SimpleCode(t_min_code='123')
     with self.assertRaises(ValidationException):
         t_min_code.validate()
     t_min_code = SimpleCode(t_min_code='1')
     with self.assertRaises(ValidationException):
         t_min_code.validate()
Пример #7
0
 def test_length_accepts_double_types_param(self):
     td_code = SimpleCode(td_code='1234')
     td_code.validate()
     td_code = SimpleCode(td_code='12345')
     td_code.validate()
     td_code = SimpleCode(td_code='123456')
     with self.assertRaises(ValidationException):
         td_code.validate()
     td_code = SimpleCode(td_code='123')
     with self.assertRaises(ValidationException):
         td_code.validate()
Пример #8
0
 def test_length_accepts_double_callable_param(self):
     cd_code = SimpleCode(cd_code='1234')
     cd_code.validate()
     cd_code = SimpleCode(cd_code='12345')
     cd_code.validate()
     cd_code = SimpleCode(cd_code='123456')
     with self.assertRaises(ValidationException):
         cd_code.validate()
     cd_code = SimpleCode(cd_code='123')
     with self.assertRaises(ValidationException):
         cd_code.validate()
Пример #9
0
 def test_minlength_does_not_raise_if_length_is_greater_than_or_equal_to_callable_minlength_in_str(
         self):
     c_min_code = SimpleCode(c_min_code='1234')
     c_min_code.validate()
     c_min_code = SimpleCode(c_min_code='123456')
     c_min_code.validate()
Пример #10
0
 def test_maxlength_does_not_raise_if_length_is_less_than_or_equal_to_constant_maxlength_in_str(self):
     max_code = SimpleCode(max_code='1234')
     max_code.validate()
     max_code = SimpleCode(max_code='12345678')
     max_code.validate()
Пример #11
0
 def test_maxlength_does_not_raise_if_length_is_less_than_or_equal_to_types_maxlength_in_list(self):
     tl_max_code = SimpleCode(tl_max_code=[1, 2, 3, 4])
     tl_max_code.validate()
     tl_max_code = SimpleCode(tl_max_code=[1, 2, 3, 4, 5, 6, 7, 8])
     tl_max_code.validate()
Пример #12
0
 def test_maxlength_does_not_raise_if_length_is_less_than_or_equal_to_callable_maxlength_in_list(self):
     cl_max_code = SimpleCode(l_max_code=[1, 2, 3, 4])
     cl_max_code.validate()
     cl_max_code = SimpleCode(l_max_code=[1, 2, 3, 4, 5, 6, 7, 8])
     cl_max_code.validate()
Пример #13
0
 def test_maxlength_does_not_raise_if_length_is_less_than_or_equal_to_callable_maxlength_in_str(self):
     c_max_code = SimpleCode(c_max_code='1234')
     c_max_code.validate()
     c_max_code = SimpleCode(c_max_code='12345678')
     c_max_code.validate()
Пример #14
0
 def test_minlength_does_not_raise_if_length_is_greater_than_or_equal_to_callable_minlength_in_list(
         self):
     cl_min_code = SimpleCode(cl_min_code=[1, 2, 3, 4])
     cl_min_code.validate()
     cl_min_code = SimpleCode(cl_min_code=[1, 2, 3, 4, 5])
     cl_min_code.validate()
Пример #15
0
 def test_length_should_match_length_in_list(self):
     l_code = SimpleCode(l_code=[1, 2, 3, 4])
     l_code.validate()
Пример #16
0
 def test_length_should_match_length_in_str(self):
     code = SimpleCode(code='1234')
     code.validate()
Пример #17
0
 def test_minlength_does_not_raise_if_length_is_greater_than_or_equal_to_types_minlength_in_list(
         self):
     tl_min_code = SimpleCode(tl_min_code=[1, 2, 3, 4])
     tl_min_code.validate()
     tl_min_code = SimpleCode(tl_min_code=[1, 2, 3, 4, 5])
     tl_min_code.validate()
Пример #18
0
 def test_minlength_does_not_raise_if_length_is_greater_than_or_equal_to_types_minlength_in_str(
         self):
     t_min_code = SimpleCode(t_min_code='1234')
     t_min_code.validate()
     t_min_code = SimpleCode(t_min_code='123456')
     t_min_code.validate()