Пример #1
0
class FileCoverageTest(unittest.TestCase):

    def setUp(self):
        file = os.path.join(os.path.dirname(__file__), 'data', 'test.xml')
        tree = xml.etree.ElementTree.parse(file)
        element = tree.findall('./project//file')[0]
        self.coverage = FileCoverage('/path/to/file.php', element)

    def test_is_parsed(self):
        self.assertFalse(self.coverage.is_parsed())
        self.coverage.parse()
        self.assertTrue(self.coverage.is_parsed())

    def test_parse(self):
        self.coverage.parse()
        self.assertEquals(self.coverage.num_lines, 16)
        self.assertEquals(self.coverage.covered, 0)
        self.assertEquals(self.coverage.statements, 4)
        self.assertEquals(self.coverage.good_lines, [])
        self.assertEquals(self.coverage.bad_lines, [12, 13, 14, 15])

    def test_get_implicit_parse(self):
        self.assertEquals(self.coverage.num_lines, 16)
Пример #2
0
 def setUp(self):
     file = os.path.join(os.path.dirname(__file__), 'data', 'test.xml')
     tree = xml.etree.ElementTree.parse(file)
     element = tree.findall('./project//file')[0]
     self.coverage = FileCoverage('/path/to/file.php', element)