Skip to content

Commit 78ede19

Browse files
committed
Fix strategy bad input tests
Because all the calls in this test were expected to raise an error, after the first one, none of the others were even tried. This makes each failing call a separate test.
1 parent ae3e9d7 commit 78ede19

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tests/test_strategies.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,13 @@ def test_square_strategy(square_strategy, num_plots, grid_arrangement):
6060

6161

6262
# Test for bad input
63-
def test_strategy_with_bad_input(rectangular_strategy, square_strategy):
63+
@pytest.mark.parametrize("n", [-1, -1000])
64+
def test_rectangular_strategy_with_bad_input(rectangular_strategy, n):
6465
with pytest.raises(ValueError):
65-
rectangular_strategy.get_grid(-1)
66-
rectangular_strategy.get_grid(-1000)
66+
rectangular_strategy.get_grid(n)
6767

68-
square_strategy.get_grid(-1)
69-
square_strategy.get_grid(-110)
68+
69+
@pytest.mark.parametrize("n", [-1, -1000])
70+
def test_square_strategy_with_bad_input(square_strategy, n):
71+
with pytest.raises(ValueError):
72+
square_strategy.get_grid(n)

0 commit comments

Comments
 (0)