summaryrefslogtreecommitdiff
path: root/test/test_arcs.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2013-01-11 23:07:37 -0500
committerNed Batchelder <ned@nedbatchelder.com>2013-01-11 23:07:37 -0500
commitd1d23014a113c00f3427d0acb4b1d23da361288c (patch)
treefb50b73874c855c024f7d577df81bfe5dbb954d6 /test/test_arcs.py
parent70265ed72c66aacedebb4b75996a74d17aeab649 (diff)
downloadpython-coveragepy-d1d23014a113c00f3427d0acb4b1d23da361288c.tar.gz
Better understanding of how the trace function is invoked as byte codes are executed. Fixes #175.
Diffstat (limited to 'test/test_arcs.py')
-rw-r--r--test/test_arcs.py44
1 files changed, 25 insertions, 19 deletions
diff --git a/test/test_arcs.py b/test/test_arcs.py
index 8870c6c..1fce57e 100644
--- a/test/test_arcs.py
+++ b/test/test_arcs.py
@@ -299,25 +299,31 @@ class LoopArcTest(CoverageTest):
arcz=".1 .2 23 32 34 47 26 67 7. 18 89 9."
)
- if 0: # expected failure
- def test_confusing_for_loop_bug_175(self):
- self.check_coverage("""\
- o = [(1,2), (3,4)]
- o = [a for a in o]
- for tup in o:
- x = tup[0]
- y = tup[1]
- """,
- arcz=".1 12 23 34 45 53 3.",
- arcz_missing="", arcz_unpredicted="")
- self.check_coverage("""\
- o = [(1,2), (3,4)]
- for tup in [a for a in o]:
- x = tup[0]
- y = tup[1]
- """,
- arcz=".1 12 23 34 42 2.",
- arcz_missing="", arcz_unpredicted="")
+ def test_confusing_for_loop_bug_175(self):
+ if sys.version_info >= (3, 0):
+ # Py3 counts the list comp as a separate code object.
+ arcz = ".1 .2 2-2 12 23 34 45 53 3."
+ else:
+ arcz = ".1 12 23 34 45 53 3."
+ self.check_coverage("""\
+ o = [(1,2), (3,4)]
+ o = [a for a in o]
+ for tup in o:
+ x = tup[0]
+ y = tup[1]
+ """,
+ arcz=arcz, arcz_missing="", arcz_unpredicted="")
+ if sys.version_info >= (3, 0):
+ arcz = ".1 12 .2 2-2 23 34 42 2."
+ else:
+ arcz = ".1 12 23 34 42 2."
+ self.check_coverage("""\
+ o = [(1,2), (3,4)]
+ for tup in [a for a in o]:
+ x = tup[0]
+ y = tup[1]
+ """,
+ arcz=arcz, arcz_missing="", arcz_unpredicted="")
class ExceptionArcTest(CoverageTest):