Beispiel #1
0
 def test_02_04_bad_max(self):
     s = IntegerRange("foo", (1, 15), maxval=20)
     s.value_text = s.compose_max_text("21")
     assert s.max == 20
     assert s.max_text == "21"
     with pytest.raises(ValidationError):
         (lambda: s.test_valid(None))()
Beispiel #2
0
 def test_01_04_set_max(self):
     s = IntegerRange("foo", (1, 15))
     s.value_text = s.compose_max_text("016")
     assert s.min == 1
     assert s.max == 16
     assert s.min_text == "1"
     assert s.max_text == "016"
     s.test_valid(None)
Beispiel #3
0
 def test_01_05_set_max_bad(self):
     s = IntegerRange("foo", (1, 15))
     s.value_text = s.compose_max_text("a2")
     assert s.min == 1
     assert s.max == 15
     assert s.min_text == "1"
     assert s.max_text == "a2"
     with pytest.raises(ValidationError):
         (lambda: s.test_valid(None))()
Beispiel #4
0
 def test_02_03_good_max(self):
     s = IntegerRange("foo", (1, 15), maxval=20)
     for test_case in ("18", "20"):
         s.value_text = s.compose_max_text(test_case)
         s.test_valid(None)