Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-92886: [clinic.py] raise exception on invalid input instead of assertion #98051

Merged
merged 2 commits into from
Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion Lib/test/test_clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def test_right_only(self):
def test_have_left_options_but_required_is_empty(self):
def fn():
clinic.permute_optional_groups(['a'], [], [])
self.assertRaises(AssertionError, fn)
self.assertRaises(ValueError, fn)


class ClinicLinearFormatTest(TestCase):
Expand Down
3 changes: 2 additions & 1 deletion Tools/clinic/clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,8 @@ def permute_optional_groups(left, required, right):
result = []

if not required:
assert not left
if left:
raise ValueError("required is empty but left is not")

accumulator = []
counts = set()
Expand Down