當前位置: 首頁>>代碼示例>>Python>>正文


Python XmlCoverageReporter.name方法代碼示例

本文整理匯總了Python中diff_cover.violations_reporter.XmlCoverageReporter.name方法的典型用法代碼示例。如果您正苦於以下問題:Python XmlCoverageReporter.name方法的具體用法?Python XmlCoverageReporter.name怎麽用?Python XmlCoverageReporter.name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在diff_cover.violations_reporter.XmlCoverageReporter的用法示例。


在下文中一共展示了XmlCoverageReporter.name方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_violations

# 需要導入模塊: from diff_cover.violations_reporter import XmlCoverageReporter [as 別名]
# 或者: from diff_cover.violations_reporter.XmlCoverageReporter import name [as 別名]
    def test_violations(self):

        # Construct the XML report
        file_paths = ['file1.py', 'subdir/file2.py']
        violations = self.MANY_VIOLATIONS
        measured = self.FEW_MEASURED
        xml = self._coverage_xml(file_paths, violations, measured)

        # Parse the report
        coverage = XmlCoverageReporter(xml)

        # Expect that the name is set
        self.assertEqual(coverage.name(), "XML")

        # By construction, each file has the same set
        # of covered/uncovered lines
        self.assertEqual(violations, coverage.violations('file1.py'))
        self.assertEqual(measured, coverage.measured_lines('file1.py'))

        # Try getting a smaller range
        result = coverage.violations('subdir/file2.py')
        self.assertEqual(result, violations)

        # Once more on the first file (for caching)
        result = coverage.violations('file1.py')
        self.assertEqual(result, violations)
開發者ID:Julian,項目名稱:diff-cover,代碼行數:28,代碼來源:test_violations_reporter.py


注:本文中的diff_cover.violations_reporter.XmlCoverageReporter.name方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。