diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2021-10-27 08:51:43 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2021-10-27 09:12:30 -0400 |
commit | 055a9f4b38aebdabc8cb80dcc40a5b29b8f71781 (patch) | |
tree | 2ef5112132ccebdb9bb0e9553fddd8de8d20c93f /coverage/parser.py | |
parent | 15aff0ad7d6c92851bc21fc39863a3949edbb9c6 (diff) | |
download | python-coveragepy-git-055a9f4b38aebdabc8cb80dcc40a5b29b8f71781.tar.gz |
fix(debug): ast_dump failed on a few things
Diffstat (limited to 'coverage/parser.py')
-rw-r--r-- | coverage/parser.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/coverage/parser.py b/coverage/parser.py index 80665b5a..ec788c06 100644 --- a/coverage/parser.py +++ b/coverage/parser.py @@ -1306,7 +1306,7 @@ def _is_simple_value(value): """Is `value` simple enough to be displayed on a single line?""" return ( value in [None, [], (), {}, set()] or - isinstance(value, (str, int, float)) + isinstance(value, (bytes, int, float, str)) ) def ast_dump(node, depth=0, print=print): # pylint: disable=redefined-builtin @@ -1352,7 +1352,10 @@ def ast_dump(node, depth=0, print=print): # pylint: disable=redefined-builtin elif isinstance(value, list): print(f"{prefix} [") for n in value: - ast_dump(n, depth + 8, print=print) + if _is_simple_value(n): + print(f"{next_indent} {n!r}") + else: + ast_dump(n, depth + 8, print=print) print(f"{next_indent}]") else: print(prefix) |