def test_lte(x): """ Given two numeric values where one is greater than or equal to the other, when lte() is called with the larger value, then it returns a function that will return the the smaller value when called with it. """ sm, lg = x validator = mod.lte(lg) assert validator(sm) == sm
def test_lte_reverse(x): """ Given two numeric values where one is greater than or equal to the other, when lte() is called with the smaller value, then it returns a function that raises ValueError when called with the larger value. """ sm, lg = x validator = mod.lte(sm) with pytest.raises(ValueError): validator(lg)