def test_isin(x): """ Given a sequence, and a value from the sequence, when isin() is called with the sequence, then it returns a function that returns the value when called with it. """ v, seq = x validator = mod.isin(seq) assert validator(v) == v
def test_isin_not_found(x): """ Given a sequence, and a value that does not belong to it, when isin() is called with the sequence, then it returns a function that raises ValueError when called with the value. """ v, seq = x validator = mod.isin(seq) with pytest.raises(ValueError): validator(v)