Пример #1
0
 def test_mul_files_flags(self):
     tested = print_counts([True, True, False], [
         'testinputs/test.txt', 'testinputs/empty.txt', 'testinputs/chinese'
     ]).split()
     expected = subprocess.check_output(
         'wc -w -l testinputs/test.txt testinputs/empty.txt testinputs/chinese',
         shell=True).decode('utf-8').split()
     self.assertEqual(tested, expected)
Пример #2
0
 def test_all_flags(self):
     tested = print_counts([True, True, True],
                           ['testinputs/test.txt']).split()
     expected = subprocess.check_output('wc testinputs/test.txt',
                                        shell=True).decode('utf-8').split()
     self.assertEqual(tested, expected)
Пример #3
0
 def test_one_file_missing(self):
     tested = print_counts([True, True, True], ['ducks'])
     expected = "wc: ducks: No such file or directory"
     self.assertEqual(tested, expected)
Пример #4
0
 def test_mul_files_one_missing(self):
     tested = print_counts([True, True, True],
                           ['testinputs/armenian', 'ducks'])
     expected = "\t1443\t31978\t396307\ttestinputs/armenian\nwc: ducks: No such file or directory\n\t1443\t31978\t396307\ttotal"
     self.assertEqual(tested, expected)
Пример #5
0
 def test_mul_dashes(self):
     tested = print_counts([True, True, False], ['-', '-'])
     expected = "wc: -: No such file or directory\nwc: -: No such file or directory\n\t0\t0\ttotal"
     self.assertEqual(tested, expected)