Test Squeezer.count_lines() with various inputs.
(self)
| 114 | configType, section, option, prev_val) |
| 115 | |
| 116 | def test_count_lines(self): |
| 117 | """Test Squeezer.count_lines() with various inputs.""" |
| 118 | editwin = self.make_mock_editor_window() |
| 119 | squeezer = self.make_squeezer_instance(editwin) |
| 120 | |
| 121 | for text_code, line_width, expected in [ |
| 122 | (r"'\n'", 80, 1), |
| 123 | (r"'\n' * 3", 80, 3), |
| 124 | (r"'a' * 40 + '\n'", 80, 1), |
| 125 | (r"'a' * 80 + '\n'", 80, 1), |
| 126 | (r"'a' * 200 + '\n'", 80, 3), |
| 127 | (r"'aa\t' * 20", 80, 2), |
| 128 | (r"'aa\t' * 21", 80, 3), |
| 129 | (r"'aa\t' * 20", 40, 4), |
| 130 | ]: |
| 131 | with self.subTest(text_code=text_code, |
| 132 | line_width=line_width, |
| 133 | expected=expected): |
| 134 | text = eval(text_code) |
| 135 | with patch.object(editwin, 'width', line_width): |
| 136 | self.assertEqual(squeezer.count_lines(text), expected) |
| 137 | |
| 138 | def test_init(self): |
| 139 | """Test the creation of Squeezer instances.""" |
nothing calls this directly
no test coverage detected