(self)
| 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. |
| 1042 | prefix = ' ' |
| 1043 | expected = ( |
| 1044 | # Basic test case |
| 1045 | " Hi.\n This is a test.\n Testing.", |
| 1046 | # Include a blank line |
| 1047 | " Hi.\n This is a test.\n \n Testing.", |
| 1048 | # Include leading and trailing blank lines |
| 1049 | " \n Hi.\n This is a test.\n Testing.\n", |
| 1050 | # Use Windows line endings |
| 1051 | " Hi.\r\n This is a test.\r\n Testing.\r\n", |
| 1052 | # Pathological case |
| 1053 | " \n Hi.\r\n This is a test.\n \r\n Testing.\r\n \n", |
| 1054 | ) |
| 1055 | predicate = lambda line: True |
| 1056 | for text, expect in zip(self.CASES, expected): |
| 1057 | self.assertEqual(indent(text, prefix, predicate), expect) |
| 1058 | |
| 1059 | def test_indent_empty_lines(self): |
| 1060 | # Add 'prefix' solely to whitespace-only lines. |
nothing calls this directly
no test coverage detected