Skip to content

Commit

Permalink
pythongh-92886: [clinic.py] raise exception on invalid input instead …
Browse files Browse the repository at this point in the history
…of assertion (pythonGH-98051)

Tests should pass with -O (assertions off).

Automerge-Triggered-By: GH:iritkatriel
  • Loading branch information
iritkatriel authored and mpage committed Oct 11, 2022
1 parent 7a39f02 commit ca135e1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
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

0 comments on commit ca135e1

Please sign in to comment.