本文整理汇总了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)