def test_Either(self) -> None:
     p = Either(Int, Float)
     with pytest.raises(ValueError) as e:
         p.validate("junk")
     assert matches(
         str(e.value),
         r"expected an element of either Int or Float, got 'junk'")
Example #2
0
 def test_Either(self, detail):
     p = Either(Int, Float)
     with pytest.raises(ValueError) as e:
         p.validate("junk", detail)
     assert str(e).endswith("ValueError") == (not detail)
Example #3
0
 def test_Either(self):
     p = Either(Int, Float)
     with pytest.raises(ValueError) as e:
         p.validate("junk")
     assert not str(e).endswith("ValueError")
 def test_Either(self, detail) -> None:
     p = Either(Int, Float)
     with pytest.raises(ValueError) as e:
         p.validate("junk", detail)
     assert (str(e.value) == "") == (not detail)
Example #5
0
 def test_Either(self, detail):
     p = Either(Int, Float)
     with pytest.raises(ValueError) as e:
         p.validate("junk", detail)
     assert str(e).endswith("ValueError") == (not detail)
Example #6
0
 def test_Either(self):
     p = Either(Int, Float)
     with pytest.raises(ValueError) as e:
         p.validate("junk")
     assert not str(e).endswith("ValueError")