Ejemplo n.º 1
0
 def test_Interval(self) -> None:
     p = Interval(Float, 0.0, 1.0)
     with pytest.raises(ValueError) as e:
         p.validate(2)
     assert matches(
         str(e.value),
         r"expected a value of type Float in range \[0.0, 1.0\], got 2")
Ejemplo n.º 2
0
 def test_Interval(self, detail):
     p = Interval(Float, 0.0, 1.0)
     with pytest.raises(ValueError) as e:
         p.validate(2, detail)
     assert str(e).endswith("ValueError") == (not detail)
Ejemplo n.º 3
0
 def test_Interval(self):
     p = Interval(Float, 0.0, 1.0)
     with pytest.raises(ValueError) as e:
         p.validate(2)
     assert not str(e).endswith("ValueError")
Ejemplo n.º 4
0
 def test_Interval(self, detail) -> None:
     p = Interval(Float, 0.0, 1.0)
     with pytest.raises(ValueError) as e:
         p.validate(2, detail)
     assert (str(e.value) == "") == (not detail)
Ejemplo n.º 5
0
 def test_Interval(self, detail):
     p = Interval(Float, 0.0, 1.0)
     with pytest.raises(ValueError) as e:
         p.validate(2, detail)
     assert str(e).endswith("ValueError") == (not detail)
Ejemplo n.º 6
0
 def test_Interval(self):
     p = Interval(Float, 0.0, 1.0)
     with pytest.raises(ValueError) as e:
         p.validate(2)
     assert not str(e).endswith("ValueError")