def test_find_nearest_in_range(series_key, value): nearest = find_nearest(series_key, value) assert find_less_than_or_equal( series_key, value) <= nearest <= find_greater_than_or_equal( series_key, value)
def test_greater_than_or_equal(series_key, value): assert find_greater_than_or_equal(series_key, value) >= value
def test_greater_than_or_equal_returns_value_from_series(data): series_key = data.draw(sampled_from(ESeries)) value = data.draw(sampled_from(series(series_key))) assert find_greater_than_or_equal(series_key, value) == value
def test_find_nearest_is_nearest(series_key, value): nearest = find_nearest(series_key, value) lower = find_less_than_or_equal(series_key, value) upper = find_greater_than_or_equal(series_key, value) assert (((nearest == lower) and (nearest - lower <= upper - nearest)) or ((nearest == upper) and (upper - nearest <= nearest - lower)))