Skip to content

Commit

Permalink
gh-113317: Argument Clinic: tear out internal text accumulator APIs (#…
Browse files Browse the repository at this point in the history
…113402)

Replace the internal accumulator APIs by using lists of strings and join().

Yak-shaving for separating out formatting code into a separate file.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
  • Loading branch information
erlend-aasland and AlexWaygood committed Dec 22, 2023
1 parent a0d3d3e commit daa658a
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 188 deletions.
30 changes: 0 additions & 30 deletions Lib/test/test_clinic.py
Expand Up @@ -3761,20 +3761,6 @@ def test_normalize_snippet(self):
actual = clinic.normalize_snippet(snippet, indent=indent)
self.assertEqual(actual, expected)

def test_accumulator(self):
acc = clinic.text_accumulator()
self.assertEqual(acc.output(), "")
acc.append("a")
self.assertEqual(acc.output(), "a")
self.assertEqual(acc.output(), "")
acc.append("b")
self.assertEqual(acc.output(), "b")
self.assertEqual(acc.output(), "")
acc.append("c")
acc.append("d")
self.assertEqual(acc.output(), "cd")
self.assertEqual(acc.output(), "")

def test_quoted_for_c_string(self):
dataset = (
# input, expected
Expand All @@ -3790,22 +3776,6 @@ def test_quoted_for_c_string(self):
out = clinic.quoted_for_c_string(line)
self.assertEqual(out, expected)

def test_rstrip_lines(self):
lines = (
"a \n"
"b\n"
" c\n"
" d \n"
)
expected = (
"a\n"
"b\n"
" c\n"
" d\n"
)
out = clinic.rstrip_lines(lines)
self.assertEqual(out, expected)

def test_format_escape(self):
line = "{}, {a}"
expected = "{{}}, {{a}}"
Expand Down

0 comments on commit daa658a

Please sign in to comment.