Skip to content

Commit 47a3847

Browse files
committed
fix substitute
1 parent af84518 commit 47a3847

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

devtools/debug.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def __repr__(self) -> str:
9090
class Debug:
9191
output_class = DebugOutput
9292
complex_nodes = (
93-
ast.Call, ast.Attribute,
93+
ast.Call, ast.Attribute, ast.Subscript,
9494
ast.IfExp, ast.BoolOp, ast.BinOp, ast.Compare,
9595
ast.DictComp, ast.ListComp, ast.SetComp, ast.GeneratorExp
9696
)

tests/test_expr_render.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ def test_simple():
2222
) == s
2323

2424

25+
def test_subscription():
26+
a = {1: 2}
27+
v = debug.format(a[1])
28+
s = re.sub(':\d{2,}', ':<line no>', str(v))
29+
assert (
30+
'tests/test_expr_render.py:<line no> test_subscription\n'
31+
' a[1]: 2 (int)'
32+
) == s
33+
34+
2535
def test_exotic_types():
2636
aa = [1, 2, 3]
2737
v = debug.format(

0 commit comments

Comments
 (0)