Skip to content

Commit

Permalink
Deterministic error message for no-fill, multi-types path
Browse files Browse the repository at this point in the history
Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
  • Loading branch information
honno and Zac-HD committed Sep 29, 2021
1 parent 88e6792 commit f413d8c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion hypothesis-python/src/hypothesis/extra/array_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,9 @@ def do_draw(self, data):
f_elems = str(elems)
else:
f_elems = f"[{elems[0]}, {elems[1]}, ..., {elems[-2]}, {elems[-1]}]"
types = tuple({type(e) for e in elems})
types = tuple(
sorted({type(e) for e in elems}, key=lambda t: t.__name__)
)
f_types = f"type {types[0]}" if len(types) == 1 else f"types {types}"
raise InvalidArgument(
f"Generated elements {f_elems} from strategy "
Expand Down

0 comments on commit f413d8c

Please sign in to comment.