Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Allow multiple positional arguments in @hypothesis.example stub
  • Loading branch information
encukou committed May 22, 2024
commit bac685fd1a50e1ef858a79d68eb4bbaf8a4e712e
8 changes: 7 additions & 1 deletion Lib/test/support/_hypothesis_stubs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ def decorator(f):
@functools.wraps(f)
def test_function(self):
for example_args, example_kwargs in examples:
with self.subTest(*example_args, **example_kwargs):
if len(example_args) < 2:
subtest_args = example_args
else:
# subTest takes up to one positional argument.
# When there are more, display them as a tuple
subtest_args = [example_args]
with self.subTest(*subtest_args, **example_kwargs):
f(self, *example_args, **example_kwargs)

else:
Expand Down