Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions tests/test_strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,21 @@ def test_rectangular_strategy_with_bad_input(rectangular_strategy, n):
def test_square_strategy_with_bad_input(square_strategy, n):
with pytest.raises(ValueError):
square_strategy.get_grid(n)


# Test for the `stripe_even` functions - it is not entirely clear that these
# will remain public, so do not take the fact that it is tested as an
# indication that this is a critical part of the public interface
@pytest.mark.parametrize(
"args, exp", [((4, 3, 2, 4), (3, 4, 3, 3, 4, 3)), ((3, 2, 1, 1), (2, 2, 1, 2))]
)
def test_stripe_even(args, exp):
act = strategies.SquareStrategy.stripe_even(*args)

assert act == exp


def test_stripe_even_value_error():
# This fails when the total number (n_more + n_less) is not even
with pytest.raises(ValueError):
strategies.SquareStrategy.stripe_even(3, 1, 4, 1)