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'")
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)
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)