Skip to content

[3.11] gh-106368: Increase Argument Clinic test coverage (#106369) #106374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Unused param is not available in 3.11
  • Loading branch information
erlend-aasland committed Jul 3, 2023
commit b0621092d725ca70db5b69a88234f1395e1c5633
38 changes: 0 additions & 38 deletions Lib/test/test_clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -885,44 +885,6 @@ def test_defining_class_param_cannot_be_optional(self):
out = self.parse_function_should_fail(block)
self.assertEqual(out, expected_error_msg)

def test_unused_param(self):
block = self.parse("""
module foo
foo.func
fn: object
k: float
i: float(unused=True)
/
*
flag: bool(unused=True) = False
""")
sig = block.signatures[1] # Function index == 1
params = sig.parameters
conv = lambda fn: params[fn].converter
dataset = (
{"name": "fn", "unused": False},
{"name": "k", "unused": False},
{"name": "i", "unused": True},
{"name": "flag", "unused": True},
)
for param in dataset:
name, unused = param.values()
with self.subTest(name=name, unused=unused):
p = conv(name)
# Verify that the unused flag is parsed correctly.
self.assertEqual(unused, p.unused)

# Now, check that we'll produce correct code.
decl = p.simple_declaration(in_parser=False)
if unused:
self.assertIn("Py_UNUSED", decl)
else:
self.assertNotIn("Py_UNUSED", decl)

# Make sure the Py_UNUSED macro is not used in the parser body.
parser_decl = p.simple_declaration(in_parser=True)
self.assertNotIn("Py_UNUSED", parser_decl)

def parse(self, text):
c = FakeClinic()
parser = DSLParser(c)
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy