Skip to content

Commit db12cdf

Browse files
authored
Merge pull request #46 from pganssle/test_stripe_even
Add tests for stripe_even
2 parents 3d636b0 + 05b0272 commit db12cdf

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/test_strategies.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,21 @@ def test_rectangular_strategy_with_bad_input(rectangular_strategy, n):
7070
def test_square_strategy_with_bad_input(square_strategy, n):
7171
with pytest.raises(ValueError):
7272
square_strategy.get_grid(n)
73+
74+
75+
# Test for the `stripe_even` functions - it is not entirely clear that these
76+
# will remain public, so do not take the fact that it is tested as an
77+
# indication that this is a critical part of the public interface
78+
@pytest.mark.parametrize(
79+
"args, exp", [((4, 3, 2, 4), (3, 4, 3, 3, 4, 3)), ((3, 2, 1, 1), (2, 2, 1, 2))]
80+
)
81+
def test_stripe_even(args, exp):
82+
act = strategies.SquareStrategy.stripe_even(*args)
83+
84+
assert act == exp
85+
86+
87+
def test_stripe_even_value_error():
88+
# This fails when the total number (n_more + n_less) is not even
89+
with pytest.raises(ValueError):
90+
strategies.SquareStrategy.stripe_even(3, 1, 4, 1)

0 commit comments

Comments
 (0)