Skip to content

Commit b53a754

Browse files
committed
Use setdefault instead of manualy keys check in hh.shapes()
1 parent 7238e6d commit b53a754

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

array_api_tests/hypothesis_helpers.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,8 @@ def tuples(elements, *, min_size=0, max_size=None, unique_by=None, unique=False)
114114
# Use this to avoid memory errors with NumPy.
115115
# See https://github.com/numpy/numpy/issues/15753
116116
def shapes(**kw):
117-
if 'min_dims' not in kw.keys():
118-
kw['min_dims'] = 0
119-
if 'min_side' not in kw.keys():
120-
kw['min_side'] = 0
117+
kw.setdefault('min_dims', 0)
118+
kw.setdefault('min_side', 0)
121119
return xps.array_shapes(**kw).filter(
122120
lambda shape: prod(i for i in shape if i) < MAX_ARRAY_SIZE
123121
)

0 commit comments

Comments
 (0)