summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_arcs.py7
-rw-r--r--tests/test_coverage.py17
-rw-r--r--tests/test_summary.py6
3 files changed, 26 insertions, 4 deletions
diff --git a/tests/test_arcs.py b/tests/test_arcs.py
index 9af4a083..60fdea37 100644
--- a/tests/test_arcs.py
+++ b/tests/test_arcs.py
@@ -151,6 +151,13 @@ class SimpleArcTest(CoverageTest):
arcz=".1 12 .2 2-2 23 3.", arcz_missing=".2 2-2",
)
+ def test_what_is_the_sound_of_no_lines_clapping(self):
+ self.check_coverage("""\
+ # __init__.py
+ """,
+ arcz=".1 1.",
+ )
+
class WithTest(CoverageTest):
"""Arc-measuring tests involving context managers."""
diff --git a/tests/test_coverage.py b/tests/test_coverage.py
index ea7604b1..c0991b04 100644
--- a/tests/test_coverage.py
+++ b/tests/test_coverage.py
@@ -109,7 +109,7 @@ class BasicCoverageTest(CoverageTest):
import sys
if not sys.path:
a = 1
- """,
+ """, # indented last line
[1,2,3], "3")
def test_multiline_initializer(self):
@@ -198,6 +198,21 @@ class SimpleStatementTest(CoverageTest):
""",
[1,2,3], "")
+ def test_more_assignments(self):
+ self.check_coverage("""\
+ x = []
+ d = {}
+ d[
+ 4 + len(x)
+ + 5
+ ] = \\
+ d[
+ 8 ** 2
+ ] = \\
+ 9
+ """,
+ [1, 2, 3], "")
+
def test_attribute_assignment(self):
# Attribute assignment
self.check_coverage("""\
diff --git a/tests/test_summary.py b/tests/test_summary.py
index 56c0b831..9d7a6fe7 100644
--- a/tests/test_summary.py
+++ b/tests/test_summary.py
@@ -607,7 +607,7 @@ class SummaryTest2(CoverageTest):
def test_empty_files(self):
# Shows that empty files like __init__.py are listed as having zero
# statements, not one statement.
- cov = coverage.Coverage()
+ cov = coverage.Coverage(branch=True)
cov.start()
import usepkgs # pragma: nested # pylint: disable=import-error,unused-variable
cov.stop() # pragma: nested
@@ -617,8 +617,8 @@ class SummaryTest2(CoverageTest):
report = repout.getvalue().replace('\\', '/')
report = re.sub(r"\s+", " ", report)
- self.assertIn("tests/modules/pkg1/__init__.py 2 0 100%", report)
- self.assertIn("tests/modules/pkg2/__init__.py 0 0 100%", report)
+ self.assertIn("tests/modules/pkg1/__init__.py 2 0 0 0 100%", report)
+ self.assertIn("tests/modules/pkg2/__init__.py 0 0 0 0 100%", report)
class ReportingReturnValueTest(CoverageTest):