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 ryan-duve committed Dec 26, 2023
1 parent a3da2cd commit 07e2364
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 07e2364

Please sign in to comment.