def test_Enum(self) -> None: p = Enum("red", "green") with pytest.raises(ValueError) as e: p.validate("junk") assert matches( str(e.value), r"invalid value: 'junk'; allowed values are red or green")
def test_Enum(self, detail): p = Enum("red", "green") with pytest.raises(ValueError) as e: p.validate("junk", detail) assert str(e).endswith("ValueError") == (not detail)
def test_Enum(self): p = Enum("red", "green") with pytest.raises(ValueError) as e: p.validate("junk") assert not str(e).endswith("ValueError")
def test_Enum(self, detail) -> None: p = Enum("red", "green") with pytest.raises(ValueError) as e: p.validate("junk", detail) assert (str(e.value) == "") == (not detail)