Beispiel #1
0
 def test_02_02_bad_min(self):
     s = IntegerRange("foo", (1, 15), minval=0)
     s.value_text = s.compose_min_text("-1")
     assert s.min == 0
     assert s.min_text == "-1"
     with pytest.raises(ValidationError):
         (lambda: s.test_valid(None))()
Beispiel #2
0
 def test_01_02_set_min(self):
     s = IntegerRange("foo", (1, 15))
     s.value_text = s.compose_min_text("02")
     assert s.min == 2
     assert s.max == 15
     assert s.min_text == "02"
     assert s.max_text == "15"
     s.test_valid(None)
Beispiel #3
0
 def test_01_03_set_min_bad(self):
     s = IntegerRange("foo", (1, 15))
     s.value_text = s.compose_min_text("a2")
     assert s.min == 1
     assert s.max == 15
     assert s.min_text == "a2"
     assert s.max_text == "15"
     with pytest.raises(ValidationError):
         (lambda: s.test_valid(None))()
Beispiel #4
0
 def test_02_01_good_min(self):
     s = IntegerRange("foo", (1, 15), minval=0)
     for test_case in ("2", "0"):
         s.value_text = s.compose_min_text(test_case)
         s.test_valid(None)