10000 gh-117431: Argument Clinic: copy forced text signature when cloning by erlend-aasland · Pull Request #117591 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-117431: Argument Clinic: copy forced text signature when cloning #117591

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
Add test
  • Loading branch information
erlend-aasland committed Apr 6, 2024
commit fd9f706e8b7c92db05445def262bb34a5f46edc8
24 changes: 24 additions & 0 deletions Lib/test/test_clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,30 @@ class C "void *" ""
err = "Illegal C basename: '.illegal.'"
self.expect_failure(block, err, lineno=7)

def test_cloned_forced_text_signature(self):
block = dedent("""
/*[clinic input]
@text_signature "($module, a[, b])"
src
a: object
b: object = NULL
/
[clinic start generated code]*/

/*[clinic input]
dst = src
[clinic start generated code]*/
""")
self.clinic.parse(block)
funcs = self.clinic.functions
self.assertEqual(len(funcs), 2)

src_docstring_lines = funcs[0].docstring.split("\n")
dst_docstring_lines = funcs[1].docstring.split("\n")
self.assertEqual(src_docstring_lines[0], "src($module, a[, b])")
self.assertEqual(dst_docstring_lines[0], "dst($module, a[, b])")
self.assertEqual(src_docstring_lines[1:], dst_docstring_lines[1:])


class ParseFileUnitTest(TestCase):
def expect_parsing_failure(
Expand Down
0