Skip to content

Commit

Permalink
Merge pull request #46 from pganssle/test_stripe_even
Browse files Browse the repository at this point in the history
Add tests for stripe_even
  • Loading branch information
pganssle committed Feb 24, 2019
2 parents 3d636b0 + 05b0272 commit db12cdf
Showing 1 changed file with 18 additions and 0 deletions.
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)

0 comments on commit db12cdf

Please sign in to comment.