Skip to content

Commit

Permalink
pythongh-113317: Move more formatting helpers into libclinic
Browse files Browse the repository at this point in the history
- Move strip_leading_and_trailing_blank_lines() and make it internal to libclinic
- Move normalize_snippet() to libclinic
- Move format_escape() to libclinic
- Move wrap_declarations() to libclinic
  • Loading branch information
erlend-aasland committed Dec 23, 2023
1 parent 8bce593 commit e03e575
Show file tree
Hide file tree
Showing 4 changed files with 164 additions and 154 deletions.
6 changes: 3 additions & 3 deletions Lib/test/test_clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3730,7 +3730,7 @@ def test_strip_leading_and_trailing_blank_lines(self):
)
for lines, expected in dataset:
with self.subTest(lines=lines, expected=expected):
out = clinic.strip_leading_and_trailing_blank_lines(lines)
out = libclinic.normalize_snippet(lines)
self.assertEqual(out, expected)

def test_normalize_snippet(self):
Expand Down Expand Up @@ -3759,7 +3759,7 @@ def test_normalize_snippet(self):
expected_outputs = {0: zero_indent, 4: four_indent, 8: eight_indent}
for indent, expected in expected_outputs.items():
with self.subTest(indent=indent):
actual = clinic.normalize_snippet(snippet, indent=indent)
actual = libclinic.normalize_snippet(snippet, indent=indent)
self.assertEqual(actual, expected)

def test_escaped_docstring(self):
Expand All @@ -3780,7 +3780,7 @@ def test_escaped_docstring(self):
def test_format_escape(self):
line = "{}, {a}"
expected = "{{}}, {{a}}"
out = clinic.format_escape(line)
out = libclinic.format_escape(line)
self.assertEqual(out, expected)

def test_indent_all_lines(self):
Expand Down
Loading

0 comments on commit e03e575

Please sign in to comment.