Skip to content

Commit

Permalink
Improve selected_indices test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
asmeurer committed Feb 8, 2024
1 parent e21f4aa commit f607d9e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions ndindex/tests/test_ndindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from .helpers import ndindices, check_same, assert_equal


@example(None)
@example([1, 2])
@given(ndindices)
def test_eq(idx):
Expand Down
8 changes: 7 additions & 1 deletion ndindex/tests/test_selected_indices.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
from numpy import arange

from hypothesis import given
from hypothesis import given, example
from hypothesis.strategies import integers, one_of

from ..ndindex import ndindex
from ..tuple import Tuple
from ..integer import Integer
from .helpers import ndindices, check_same, short_shapes, prod

@example((False, slice(0, 10)), (5, 2))
@example((None, True, 0), (5, 2))
@example((slice(0, 10), [0, -1]), (5, 2))
@example(slice(0, 10), 5)
@example([0, 1, 2], 3)
@example(([0, 1, 2],), 3)
@given(ndindices, one_of(short_shapes, integers(0, 10)))
def test_selected_indices_hypothesis(idx, shape):
if isinstance(shape, int):
Expand Down

0 comments on commit f607d9e

Please sign in to comment.