diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2016-01-01 16:10:50 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2016-01-01 16:10:50 -0500 |
commit | 529ef9857c37ab12ad10b35aa67e8fccb3d707d4 (patch) | |
tree | f84820c51ae4af0ec051a324bccd0776fdb4516c /coverage/parser.py | |
parent | d77a77ca6e8f7ccfaaf783e605ce1b60faef1dd9 (diff) | |
download | python-coveragepy-529ef9857c37ab12ad10b35aa67e8fccb3d707d4.tar.gz |
check_coverage now assumes empty missing and unpredicted, and uses branch always
Diffstat (limited to 'coverage/parser.py')
-rw-r--r-- | coverage/parser.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/coverage/parser.py b/coverage/parser.py index 3348092..2396fb8 100644 --- a/coverage/parser.py +++ b/coverage/parser.py @@ -347,7 +347,7 @@ class AstArcAnalyzer(object): def line_Dict(self, node): # Python 3.5 changed how dict literals are made. - if env.PYVERSION >= (3, 5): + if env.PYVERSION >= (3, 5) and node.keys: return node.keys[0].lineno return node.lineno @@ -587,7 +587,7 @@ class AstArcAnalyzer(object): def handle_default(self, node): node_name = node.__class__.__name__ if node_name not in ["Assign", "Assert", "AugAssign", "Expr", "Import", "Pass", "Print"]: - print("*** Unhandled: {}".format(node)) + print("*** Unhandled: {0}".format(node)) return set([self.line_for_node(node)]) CODE_COMPREHENSIONS = set(["GeneratorExp", "DictComp", "SetComp"]) @@ -1049,6 +1049,10 @@ SKIP_FIELDS = ["ctx"] def ast_dump(node, depth=0): indent = " " * depth + if not isinstance(node, ast.AST): + print("{0}<{1} {2!r}>".format(indent, node.__class__.__name__, node)) + return + lineno = getattr(node, "lineno", None) if lineno is not None: linemark = " @ {0}".format(lineno) |