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")
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)
def test_Instance(self): p = Instance(HasProps) with pytest.raises(ValueError) as e: p.validate("junk") assert not str(e).endswith("ValueError")
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)