Skip to content

Commit

Permalink
pythongh-113317: Argument Clinic: tear out internal text accumulator …
Browse files Browse the repository at this point in the history
…APIs (python#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 <[email protected]>
  • Loading branch information
2 people authored and Glyphack committed Jan 27, 2024
1 parent 14ad0b7 commit 953e82d
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
Original file line number Diff line number Diff line change
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
Loading

0 comments on commit 953e82d

Please sign in to comment.