mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +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 test_have_left_options_but_required_is_empty(self):
|
||||||
def fn():
|
def fn():
|
||||||
clinic.permute_optional_groups(['a'], [], [])
|
clinic.permute_optional_groups(['a'], [], [])
|
||||||
self.assertRaises(AssertionError, fn)
|
self.assertRaises(ValueError, fn)
|
||||||
|
|
||||||
|
|
||||||
class ClinicLinearFormatTest(TestCase):
|
class ClinicLinearFormatTest(TestCase):
|
||||||
|
|
|
@ -495,7 +495,8 @@ def permute_optional_groups(left, required, right):
|
||||||
result = []
|
result = []
|
||||||
|
|
||||||
if not required:
|
if not required:
|
||||||
assert not left
|
if left:
|
||||||
|
raise ValueError("required is empty but left is not")
|
||||||
|
|
||||||
accumulator = []
|
accumulator = []
|
||||||
counts = set()
|
counts = set()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue