MCPcopy Index your code
hub / github.com/python/cpython / test_indent_empty_lines

Method test_indent_empty_lines

Lib/test/test_textwrap.py:1059–1076  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1057 self.assertEqual(indent(text, prefix, predicate), expect)
1058
1059 def test_indent_empty_lines(self):
1060 # Add 'prefix' solely to whitespace-only lines.
1061 prefix = ' '
1062 expected = (
1063 # Basic test case
1064 "Hi.\nThis is a test.\nTesting.",
1065 # Include a blank line
1066 "Hi.\nThis is a test.\n \nTesting.",
1067 # Include leading and trailing blank lines
1068 " \nHi.\nThis is a test.\nTesting.\n",
1069 # Use Windows line endings
1070 "Hi.\r\nThis is a test.\r\nTesting.\r\n",
1071 # Pathological case
1072 " \nHi.\r\nThis is a test.\n \r\nTesting.\r\n \n",
1073 )
1074 predicate = lambda line: not line.strip()
1075 for text, expect in zip(self.CASES, expected):
1076 self.assertEqual(indent(text, prefix, predicate), expect)
1077
1078
1079class ShortenTestCase(BaseTestCase):

Callers

nothing calls this directly

Calls 3

indentFunction · 0.90
stripMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected