mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
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
This commit is contained in:
parent
3de08ce8c1
commit
34e6f3567e
2 changed files with 3 additions and 2 deletions
|
@ -153,7 +153,7 @@ class ClinicGroupPermuterTest(TestCase):
|
|||
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):
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue