def testGitLines(self): with open(__file__, 'r') as fid: lines = fid.readlines() n_with_blank = len(lines) n_no_blank = n_with_blank - len([l for l in lines if not l.strip()]) counts = mooseutils.git_lines(__file__) self.assertIn('Andrew E. Slaughter', counts) self.assertTrue(counts['Andrew E. Slaughter'] > 0) self.assertEqual(n_no_blank, sum(list(counts.values()))) counts = mooseutils.git_lines(__file__, blank=True) self.assertIn('Andrew E. Slaughter', counts) self.assertTrue(counts['Andrew E. Slaughter'] > 0) self.assertEqual(n_with_blank, sum(list(counts.values())))
def target(filename): """Helper for counting the lines, by author of the given filename""" return mooseutils.git_lines(filename)