Skip to content

Commit ca71987

Browse files
gh-113317: Move more formatting helpers into libclinic (#113438)
Move the following global helpers into libclinic: - format_escape() - normalize_snippet() - wrap_declarations() Also move strip_leading_and_trailing_blank_lines() and make it internal to libclinic.
1 parent 8bce593 commit ca71987

File tree

4 files changed

+160
-159
lines changed

4 files changed

+160
-159
lines changed

Lib/test/test_clinic.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -3730,7 +3730,7 @@ def test_strip_leading_and_trailing_blank_lines(self):
37303730
)
37313731
for lines, expected in dataset:
37323732
with self.subTest(lines=lines, expected=expected):
3733-
out = clinic.strip_leading_and_trailing_blank_lines(lines)
3733+
out = libclinic.normalize_snippet(lines)
37343734
self.assertEqual(out, expected)
37353735

37363736
def test_normalize_snippet(self):
@@ -3759,7 +3759,7 @@ def test_normalize_snippet(self):
37593759
expected_outputs = {0: zero_indent, 4: four_indent, 8: eight_indent}
37603760
for indent, expected in expected_outputs.items():
37613761
with self.subTest(indent=indent):
3762-
actual = clinic.normalize_snippet(snippet, indent=indent)
3762+
actual = libclinic.normalize_snippet(snippet, indent=indent)
37633763
self.assertEqual(actual, expected)
37643764

37653765
def test_escaped_docstring(self):
@@ -3780,7 +3780,7 @@ def test_escaped_docstring(self):
37803780
def test_format_escape(self):
37813781
line = "{}, {a}"
37823782
expected = "{{}}, {{a}}"
3783-
out = clinic.format_escape(line)
3783+
out = libclinic.format_escape(line)
37843784
self.assertEqual(out, expected)
37853785

37863786
def test_indent_all_lines(self):

0 commit comments

Comments
 (0)