def test_timestamp(x): """ Given a time- or datestamp and matching format in strptime() notation, when timestamp() is called with the format string, then it returns a function which returns the timestamp when called with it. """ s, fmt = x validator = mod.timestamp(fmt) assert validator(s) == s
def test_timestamp_reverse(x): s, fmt = x validator = mod.timestamp(fmt) with pytest.raises(ValueError): validator(s)