Esempio n. 1
0
 def test_can_collect_totals(self):
     source_analyses = (
         analysis.SourceAnalysis('some.py', 'Python', 'some', 1, 2, 3, 4),
         analysis.SourceAnalysis('other.py', 'Python', 'some', 10, 20, 30, 40),
     )
     with tempfile.NamedTemporaryFile('w', encoding='utf-8', prefix='pygount_', suffix='.tmp') as target_stream:
         with write.BaseWriter(target_stream) as writer:
             for source_analysis in source_analyses:
                 writer.add(source_analysis)
     self.assertEqual(writer.total_source_count, 2)
     self.assertEqual(writer.total_line_count, 110)
Esempio n. 2
0
def test_can_collect_totals():
    source_analyses = (
        analysis.SourceAnalysis("some.py", "Python", "some", 1, 2, 3, 4,
                                analysis.SourceState.analyzed.name, None),
        analysis.SourceAnalysis("other.py", "Python", "some", 10, 20, 30, 40,
                                analysis.SourceState.analyzed.name, None),
    )
    with tempfile.NamedTemporaryFile("w",
                                     encoding="utf-8",
                                     prefix="pygount_",
                                     suffix=".tmp") as target_stream:
        with write.BaseWriter(target_stream) as writer:
            for source_analysis in source_analyses:
                writer.add(source_analysis)
    assert writer.total_source_count == 2
    assert writer.total_line_count == 110