summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-07-04 00:26:44 (GMT)
committerGitHub <noreply@github.com>2023-07-04 00:26:44 (GMT)
commitb84365fe3eaa52bac8ffa7369ad0496a807aa8a7 (patch)
tree6179df8254fdf5a4cef4ff1dbeff7dd288fdad37 /Lib
parent6720003dae318c417687a8d8b1ecf54b7cad6554 (diff)
downloadcpython-b84365fe3eaa52bac8ffa7369ad0496a807aa8a7.zip
cpython-b84365fe3eaa52bac8ffa7369ad0496a807aa8a7.tar.gz
cpython-b84365fe3eaa52bac8ffa7369ad0496a807aa8a7.tar.bz2
[3.12] gh-106368: Increase Argument Clinic test coverage (GH-106389) (#106390)
Add: - test_disallowed_gropuing__no_matching_bracket - test_double_slash (cherry picked from commit 3406f8cce542ea4edf4153c0fac5216df283a9b1) Co-authored-by: Erlend E. Aasland <erlend@python.org>
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_clinic.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/Lib/test/test_clinic.py b/Lib/test/test_clinic.py
index c5cfe53..03754d0 100644
--- a/Lib/test/test_clinic.py
+++ b/Lib/test/test_clinic.py
@@ -730,6 +730,18 @@ class ClinicParserTest(TestCase):
)
self.assertIn(msg, out)
+ def test_disallowed_grouping__no_matching_bracket(self):
+ out = self.parse_function_should_fail("""
+ module foo
+ foo.empty_group
+ param: int
+ ]
+ group2: int
+ ]
+ """)
+ msg = "Function empty_group has a ] without a matching [."
+ self.assertIn(msg, out)
+
def test_no_parameters(self):
function = self.parse_function("""
module foo
@@ -809,6 +821,18 @@ class ClinicParserTest(TestCase):
)
self.assertIn(msg, out)
+ def test_double_slash(self):
+ out = self.parse_function_should_fail("""
+ module foo
+ foo.bar
+ a: int
+ /
+ b: int
+ /
+ """)
+ msg = "Function bar uses '/' more than once."
+ self.assertIn(msg, out)
+
def test_mix_star_and_slash(self):
out = self.parse_function_should_fail("""
module foo