def test_writing_to_unwilling_outputter_does_not_raise_exception(self): filter_lines(LINES, CATCH_ALL_PATTERN, UnwillingOutputter())
def test_pattern_matches_in_the_middle_of_the_string(self): filter_lines(LINES, MIDDLE_STRING_PATTERN, self.outputter) filtered_lines = self.outputter.filtered_lines self.assertEqual(len(LINES), len(filtered_lines))
def test_multi_line_pattern_matches_multiple_lines(self): filter_lines(LINES, MULTILINE_PATTERN, self.outputter) filtered_lines = self.outputter.filtered_lines self.assertEqual(2, len(filtered_lines))
def test_single_line_pattern_matches_single_line(self): filter_lines(LINES, SINGLE_LINE_PATTERN, self.outputter) filtered_lines = self.outputter.filtered_lines self.assertEqual(1, len(filtered_lines)) self.assertIn(SINGLE_LINE_PATTERN, filtered_lines)
def test_unmatchable_pattern_returns_no_lines(self): filter_lines(LINES, CATCH_NOTHING_PATTERN, self.outputter) filtered_lines = self.outputter.filtered_lines self.assertEqual(0, len(filtered_lines))
def test_catch_all_pattern_returns_all_lines(self): filter_lines(LINES, CATCH_ALL_PATTERN, self.outputter) filtered_lines = self.outputter.filtered_lines self.assertEqual(len(LINES), len(filtered_lines)) self.assertEqual(LINES, filtered_lines)