Esempio n. 1
0
 def test_Instance(self) -> None:
     p = Instance(HasProps)
     with pytest.raises(ValueError) as e:
         p.validate("junk")
     assert matches(
         str(e.value),
         r"expected an instance of type HasProps, got junk of type str")
Esempio n. 2
0
 def test_Instance(self, detail):
     p = Instance(HasProps)
     with pytest.raises(ValueError) as e:
         p.validate("junk", detail)
     assert str(e).endswith("ValueError") == (not detail)
Esempio n. 3
0
 def test_Instance(self):
     p = Instance(HasProps)
     with pytest.raises(ValueError) as e:
         p.validate("junk")
     assert not str(e).endswith("ValueError")
Esempio n. 4
0
 def test_Instance(self, detail) -> None:
     p = Instance(HasProps)
     with pytest.raises(ValueError) as e:
         p.validate("junk", detail)
     assert (str(e.value) == "") == (not detail)
Esempio n. 5
0
 def test_Instance(self, detail):
     p = Instance(HasProps)
     with pytest.raises(ValueError) as e:
         p.validate("junk", detail)
     assert str(e).endswith("ValueError") == (not detail)
Esempio n. 6
0
 def test_Instance(self):
     p = Instance(HasProps)
     with pytest.raises(ValueError) as e:
         p.validate("junk")
     assert not str(e).endswith("ValueError")