예제 #1
0
 def test09_integration_full_pipeline_no_match_fail(self, *ignore):
     pipeline = pgrep_pipeline.get_text(pgrep_pipeline.find_word(
                   pgrep_pipeline.print_line_and_file(), 'foundyou'))
     with ReplaceStandardOutput() as changed_stdout:
         pipeline.send('hello.txt')
         self.assertEqual(changed_stdout.getvalue().strip(), '')
예제 #2
0
 def test08_integration_full_pipeline_success(self, *ignore):
     pipeline = pgrep_pipeline.get_text(pgrep_pipeline.find_word(
                   pgrep_pipeline.print_line_and_file(), 'findme'))
     with ReplaceStandardOutput() as changed_stdout:
         pipeline.send('hello.txt')
         self.assertEqual(changed_stdout.getvalue().strip(), 'hello.txt 1: want to findme')
예제 #3
0
 def test04_find_word_not_found_fail(self):
     with ReplaceStandardOutput() as changed_stdout:
         pipeline = pgrep_pipeline.find_word(printer(), 'findme')
         pipeline.send((1, 'cant find you', 'hello.txt'))
         self.assertEqual(changed_stdout.getvalue().strip(), '')
예제 #4
0
 def test05_find_word_invalid_arg_type_fail(self):
     pipeline = pgrep_pipeline.find_word(printer(), 'findme')
     with self.assertRaises(ValueError):
         pipeline.send([])
         pgrep_pipeline.find_word(printer(), 'findme')
예제 #5
0
 def test03_find_word_success(self):
     with ReplaceStandardOutput() as changed_stdout:
         pipeline = pgrep_pipeline.find_word(printer(), 'findme')
         pipeline.send((1, 'findme now', 'hello.txt'))
         self.assertEqual(changed_stdout.getvalue().strip(), "(1, 'findme now', 'hello.txt')")