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

Method test_indent_explicit_default

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

Source from the content-addressed store, hash-verified

1020 self.assertEqual(indent(text, prefix), expect)
1021
1022 def test_indent_explicit_default(self):
1023 # Test default indenting of lines that are not whitespace only
1024 prefix = ' '
1025 expected = (
1026 # Basic test case
1027 " Hi.\n This is a test.\n Testing.",
1028 # Include a blank line
1029 " Hi.\n This is a test.\n\n Testing.",
1030 # Include leading and trailing blank lines
1031 "\n Hi.\n This is a test.\n Testing.\n",
1032 # Use Windows line endings
1033 " Hi.\r\n This is a test.\r\n Testing.\r\n",
1034 # Pathological case
1035 "\n Hi.\r\n This is a test.\n\r\n Testing.\r\n\n",
1036 )
1037 for text, expect in zip(self.CASES, expected):
1038 self.assertEqual(indent(text, prefix, None), expect)
1039
1040 def test_indent_all_lines(self):
1041 # Add 'prefix' to all lines, including whitespace-only ones.

Callers

nothing calls this directly

Calls 2

indentFunction · 0.90
assertEqualMethod · 0.45

Tested by

no test coverage detected