def test_lines(self): self.assertEqual(2,wc("lines",self.file_name))
def test_chars(self): self.assertEqual(27,wc("chars",self.file_name))
def test_wc_works_for_lines(self): self.assertEqual(3, wc(['wc', 'lines', 'test_file'])) self.assertEqual(1, wc(['wc', 'lines', 'file.txt']))
def test_wc_works_for_chars(self): self.assertEqual(51, wc(['wc', 'chars', 'test_file'])) self.assertEqual(0, wc(['wc', 'chars', 'file.txt']))
def test_wc_chars(self): self.assertEqual(48, wc('chars', 'test_file'))
def test_wc_works_for_words(self): self.assertEqual(11, wc(['wc', 'words', 'test_file'])) self.assertEqual(0, wc(['wc', 'words', 'file.txt']))
def test_words_count(self): self.assertEqual(wc("words", self.filename), 15) output = int(subprocess.getoutput("wc -w " + self.filename).split(" ")[0]) self.assertEqual(wc("words", self.filename), output)
def test_with_words_command(self): self.assertEqual(solution.wc('words', 'test_text_file.txt'), 20)
def test_wc_chars(self): self.assertEqual(12, solution.wc("chars", self.filename1)) self.assertEqual(17, solution.wc("chars", self.filename2)) self.assertEqual(0, solution.wc("chars", self.filename3))
def test_chars_count(self): self.assertEqual(wc("chars" ,self.filename), len(self.content)) output = int(subprocess.getoutput("wc -c " + self.filename).split(" ")[0]) self.assertEqual(wc("chars", self.filename), output)
def test_wc_words(self): self.assertEqual(3, solution.wc("words", self.filename1)) self.assertEqual(4, solution.wc("words", self.filename2)) self.assertEqual(0, solution.wc("words", self.filename3))
def test_wc_lines(self): self.assertEqual(1, solution.wc("lines", self.filename1)) self.assertEqual(2, solution.wc("lines", self.filename2)) self.assertEqual(1, solution.wc("lines", self.filename3))
def test_wc_lines(self): self.assertEqual(4, wc('lines', 'test_file'))
def test_words(self): self.assertEqual(6,wc("words",self.file_name))
def test_lines_count(self): self.assertEqual(wc("lines", self.filename), 5) output = int(subprocess.getoutput("wc -l " + self.filename).split(" ")[0]) self.assertEqual(wc("lines", self.filename), output)
def test_with_chars_command(self): self.assertEqual(solution.wc('chars', 'test_text_file.txt'), 109)
def test_wc_works_without_parameters(self): self.assertEqual("Please give a command and a filename.", wc([]))
def test_with_lines_command(self): self.assertEqual(solution.wc('lines', 'test_text_file.txt'), 3)
def test_wc_words(self): self.assertEqual(10, wc('words', 'test_file'))