Skip to content

Commit 34e6f35

Browse files
authored
gh-92886: [clinic.py] raise exception on invalid input instead of assertion (GH-98051)
Tests should pass with -O (assertions off). Automerge-Triggered-By: GH:iritkatriel
1 parent 3de08ce commit 34e6f35

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Lib/test/test_clinic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def test_right_only(self):
153153
def test_have_left_options_but_required_is_empty(self):
154154
def fn():
155155
clinic.permute_optional_groups(['a'], [], [])
156-
self.assertRaises(AssertionError, fn)
156+
self.assertRaises(ValueError, fn)
157157

158158

159159
class ClinicLinearFormatTest(TestCase):

Tools/clinic/clinic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,8 @@ def permute_optional_groups(left, required, right):
495495
result = []
496496

497497
if not required:
498-
assert not left
498+
if left:
499+
raise ValueError("required is empty but left is not")
499500

500501
accumulator = []
501502
counts = set()

0 commit comments

Comments
 (0)