Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc3f92f6

Browse files
gh-113317: Clean up Argument Clinic global namespace (#113414)
Split up clinic.py by establishing libclinic as a support package forArgument Clinic. Get rid of clinic.py globals by either making themclass members, or by putting them into libclinic.- Move INCLUDE_COMMENT_COLUMN to BlockPrinter- Move NO_VARARG to CLanguage- Move formatting helpers to libclinic- Move some constants to libclinic (and annotate them as Final)
1 parent9c3ddf3 commitc3f92f6

File tree

4 files changed

+185
-135
lines changed

4 files changed

+185
-135
lines changed

‎Lib/test/test_clinic.py‎

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
test_tools.skip_if_missing('clinic')
1818
withtest_tools.imports_under_tool('clinic'):
19+
importlibclinic
1920
importclinic
2021
fromclinicimportDSLParser
2122

@@ -3761,19 +3762,19 @@ def test_normalize_snippet(self):
37613762
actual=clinic.normalize_snippet(snippet,indent=indent)
37623763
self.assertEqual(actual,expected)
37633764

3764-
deftest_quoted_for_c_string(self):
3765+
deftest_escaped_docstring(self):
37653766
dataset= (
37663767
# input, expected
3767-
(r"abc",r"abc"),
3768-
(r"\abc",r"\\abc"),
3769-
(r"\a\bc",r"\\a\\bc"),
3770-
(r"\a\\bc",r"\\a\\\\bc"),
3771-
(r'"abc"',r'\"abc\"'),
3772-
(r"'a'",r"\'a\'"),
3768+
(r"abc",r'"abc"'),
3769+
(r"\abc",r'"\\abc"'),
3770+
(r"\a\bc",r'"\\a\\bc"'),
3771+
(r"\a\\bc",r'"\\a\\\\bc"'),
3772+
(r'"abc"',r'"\"abc\""'),
3773+
(r"'a'",r'"\'a\'"'),
37733774
)
37743775
forline,expectedindataset:
37753776
withself.subTest(line=line,expected=expected):
3776-
out=clinic.quoted_for_c_string(line)
3777+
out=libclinic.docstring_for_c_string(line)
37773778
self.assertEqual(out,expected)
37783779

37793780
deftest_format_escape(self):
@@ -3784,7 +3785,7 @@ def test_format_escape(self):
37843785

37853786
deftest_indent_all_lines(self):
37863787
# Blank lines are expected to be unchanged.
3787-
self.assertEqual(clinic.indent_all_lines("",prefix="bar"),"")
3788+
self.assertEqual(libclinic.indent_all_lines("",prefix="bar"),"")
37883789

37893790
lines= (
37903791
"one\n"
@@ -3794,7 +3795,7 @@ def test_indent_all_lines(self):
37943795
"barone\n"
37953796
"bartwo"
37963797
)
3797-
out=clinic.indent_all_lines(lines,prefix="bar")
3798+
out=libclinic.indent_all_lines(lines,prefix="bar")
37983799
self.assertEqual(out,expected)
37993800

38003801
# If last line is empty, expect it to be unchanged.
@@ -3810,12 +3811,12 @@ def test_indent_all_lines(self):
38103811
"bartwo\n"
38113812
""
38123813
)
3813-
out=clinic.indent_all_lines(lines,prefix="bar")
3814+
out=libclinic.indent_all_lines(lines,prefix="bar")
38143815
self.assertEqual(out,expected)
38153816

38163817
deftest_suffix_all_lines(self):
38173818
# Blank lines are expected to be unchanged.
3818-
self.assertEqual(clinic.suffix_all_lines("",suffix="foo"),"")
3819+
self.assertEqual(libclinic.suffix_all_lines("",suffix="foo"),"")
38193820

38203821
lines= (
38213822
"one\n"
@@ -3825,7 +3826,7 @@ def test_suffix_all_lines(self):
38253826
"onefoo\n"
38263827
"twofoo"
38273828
)
3828-
out=clinic.suffix_all_lines(lines,suffix="foo")
3829+
out=libclinic.suffix_all_lines(lines,suffix="foo")
38293830
self.assertEqual(out,expected)
38303831

38313832
# If last line is empty, expect it to be unchanged.
@@ -3841,7 +3842,7 @@ def test_suffix_all_lines(self):
38413842
"twofoo\n"
38423843
""
38433844
)
3844-
out=clinic.suffix_all_lines(lines,suffix="foo")
3845+
out=libclinic.suffix_all_lines(lines,suffix="foo")
38453846
self.assertEqual(out,expected)
38463847

38473848

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp