def test_printcountext_without_files(self): """Make sure printed output is sensible when no files are there to get extensions for.""" expected = "No files in %s" % self.tempdir old_stdout = sys.stdout sys.stdout = found = StringIO() countext.printextcount() self.assertEqual(found.getvalue().strip(), expected) sys.stdout = old_stdout
def test_printcountext(self): """Make sure printed output is as expected.""" expected = "In %s:\nExt \tCount\n----\t-----\n.py\t3\n.doc\t2\n<none>\t1\n.txt\t1" % self.tempdir old_stdout = sys.stdout sys.stdout = found = StringIO() countext.printextcount() self.assertEqual(found.getvalue().strip(), expected) sys.stdout = old_stdout