def test_String(self): p = String() with pytest.raises(ValueError) as e: p.validate(10) assert matches( str(e.value), r"expected a value of type (str|basestring), got 10 of type int")
def test_String(self, detail): p = String() with pytest.raises(ValueError) as e: p.validate(10, detail) assert str(e).endswith("ValueError") == (not detail)
def test_String(self): p = String() with pytest.raises(ValueError) as e: p.validate(10) assert not str(e).endswith("ValueError")
def test_String(self, detail) -> None: p = String() with pytest.raises(ValueError) as e: p.validate(10, detail) assert (str(e.value) == "") == (not detail)