def test_range_check(): # Floats are always returned assert range_check(10, 11) == (10.0, 11.0) assert range_check(6.4, 30) == (6.4, 30.0) # Invalid ranges give a ValueErro with raises(ValueError) as err: range_check(7, 2) assert str(err.value) == 'low >= high'
def test_range_check_returns_range_as_is_if_first_is_less_than_second(x, d): # Pull data such that the first is less than the second. if isinstance(x, float): y = d.draw(floats(min_value=x + 1.0, max_value=1E9, allow_nan=False)) else: y = d.draw(integers(min_value=x + 1)) assert range_check(x, y) == (x, y)
def test_range_check_returns_range_as_is_if_first_is_less_than_second(x, d): # Pull data such that the first is less than the second. if isinstance(x, float): y = d.draw(floats(min_value=x + 1.0, max_value=1e9, allow_nan=False)) else: y = d.draw(integers(min_value=x + 1)) assert range_check(x, y) == (x, y)
def test_range_check_returns_range_as_is_but_with_floats_example(): assert range_check(10, 11) == (10.0, 11.0) assert range_check(6.4, 30) == (6.4, 30.0)
def test_range_check_raises_ValueError_if_second_is_less_than_first(x, data): # Pull data such that the first is greater than or equal to the second. y = data.draw(floats(max_value=x, allow_nan=False)) with raises(ValueError) as err: range_check(x, y) assert str(err.value) == 'low >= high'
def test_range_check_raises_ValueError_if_second_is_less_than_first_example(): with raises(ValueError) as err: range_check(7, 2) assert str(err.value) == 'low >= high'
def test_range_check_returns_range_as_is_but_with_floats_if_first_is_less_than_second( x, y): assume(float(x) < float(y)) assert range_check(x, y) == (float(x), float(y))
def test_range_check_returns_range_as_is_but_with_floats_if_first_is_less_than_second(x, y): assume(float(x) < float(y)) assert range_check(x, y) == (float(x), float(y))
def test_range_check_raises_value_error_if_second_is_less_than_first(x, d): # Pull data such that the first is greater than or equal to the second. y = d.draw(floats(max_value=x, allow_nan=False)) with pytest.raises(ValueError, match="low >= high"): range_check(x, y)
def test_range_check_raises_value_error_if_second_is_less_than_first_example(): with pytest.raises(ValueError, match="low >= high"): range_check(7, 2)
def test_range_check_raises_ValueError_if_second_is_less_than_first(x, y): assume(x >= y) with raises(ValueError) as err: range_check(x, x) assert str(err.value) == 'low >= high'
def test_range_check_returns_range_as_is_but_with_floats_if_first_is_less_than_second2( x, y): assume(x < y) assert range_check(x, y) == (x, y)
def test_range_check_raises_ValueError_if_range_is_invalid(): with raises(ValueError) as err: range_check(7, 2) assert str(err.value) == 'low >= high'
def test_range_check_returns_range_as_is_but_with_floats_if_first_is_less_than_second_example(): assert range_check(10, 11) == (10.0, 11.0) assert range_check(6.4, 30) == (6.4, 30.0)
def test_range_check_returns_range_as_is_but_with_floats_if_first_is_less_than_second_example( ): assert range_check(10, 11) == (10.0, 11.0) assert range_check(6.4, 30) == (6.4, 30.0)
def test_range_check_returns_range_as_is_but_with_floats_if_first_is_less_than_second2(x, y): assume(x < y) assert range_check(x, y) == (x, y)
def test_range_check_returns_range_as_is_but_with_floats_if_first_is_less_than_second( x, data): # Pull data such that the first is less than the second. y = data.draw(integers(min_value=x + 1)) assert range_check(x, y) == (x, y)
def test_range_check_returns_range_as_is_but_with_floats_if_first_is_less_than_second2( x, data): # Pull data such that the first is less than the second. y = data.draw(floats(min_value=x + 1.0, max_value=1E9, allow_nan=False)) assert range_check(x, y) == (x, y)