@@ -71,6 +71,12 @@ def test_two_abs_args(self):
7171from _testcapi import pyobject_vectorcall
7272
7373def foo(a, b, c):
74+ nested_dict = \
75+ {'a': {'b': {'c': {'d': 1, 'e': 2, 'f': 3}, 'g': {'h': 4, 'i': 5}},
76+ 'j': 6,
77+ 'k': {'l': 7, 'm': {'n': 8, 'o': 9}}},
78+ 'p': {'q': {'r': 10, 's': {'t': 11, 'u': {'v': 12, 'w': 13, 'x': 14}}}},
79+ 'y': {'z': 15}}
7480 bar(a, b, c)
7581
7682def bar(a, b, c):
@@ -94,7 +100,7 @@ def test_pyup_command(self):
94100 cmds_after_breakpoint = ['py-up' , 'py-up' ])
95101 self .assertMultilineMatches (bt ,
96102 r'''^.*
97- #[0-9]+ Frame 0x-?[0-9a-f]+, for file <string>, line 12 , in baz \(args=\(1, 2, 3\)\)
103+ #[0-9]+ Frame 0x-?[0-9a-f]+, for file <string>, line 17 , in baz \(args=\(1, 2, 3\)\)
98104#[0-9]+ <built-in method pyobject_vectorcall of module object at remote 0x[0-9a-f]+>
99105$''' )
100106
@@ -123,9 +129,9 @@ def test_up_then_down(self):
123129 cmds_after_breakpoint = ['py-up' , 'py-up' , 'py-down' ])
124130 self .assertMultilineMatches (bt ,
125131 r'''^.*
126- #[0-9]+ Frame 0x-?[0-9a-f]+, for file <string>, line 12 , in baz \(args=\(1, 2, 3\)\)
132+ #[0-9]+ Frame 0x-?[0-9a-f]+, for file <string>, line 17 , in baz \(args=\(1, 2, 3\)\)
127133#[0-9]+ <built-in method pyobject_vectorcall of module object at remote 0x[0-9a-f]+>
128- #[0-9]+ Frame 0x-?[0-9a-f]+, for file <string>, line 12 , in baz \(args=\(1, 2, 3\)\)
134+ #[0-9]+ Frame 0x-?[0-9a-f]+, for file <string>, line 17 , in baz \(args=\(1, 2, 3\)\)
129135$''' )
130136
131137class PyPrintTests (DebuggerTests ):
@@ -162,6 +168,22 @@ def test_printing_builtin(self):
162168 cmds_after_breakpoint = ['py-up' , 'py-print len' ])
163169 self .assertMultilineMatches (bt ,
164170 r".*\nbuiltin 'len' = <built-in method len of module object at remote 0x-?[0-9a-f]+>\n.*" )
171+
172+ @unittest .skipIf (python_is_optimized (),
173+ "Python was compiled with optimizations" )
174+ def test_pretty_printing (self ):
175+ 'Verify that the "py-print" with pretty printing command works'
176+ bt = self .get_stack_trace (source = SAMPLE_WITH_C_CALL ,
177+ cmds_after_breakpoint = ['py-up' , 'py-up' , 'set py-verbose-print on' , 'py-print nested_dict' ])
178+ self .assertMultilineMatches (bt ,
179+ r'''.*^
180+ local 'nested_dict' = \\
181+ {'a': {'b': {'c': {'d': 1, 'e': 2, 'f': 3}, 'g': {'h': 4, 'i': 5}},
182+ 'j': 6,
183+ 'k': {'l': 7, 'm': {'n': 8, 'o': 9}}},
184+ 'p': {'q': {'r': 10, 's': {'t': 11, 'u': {'v': 12, 'w': 13, 'x': 14}}}},
185+ 'y': {'z': 15}}.*$
186+ ''' )
165187
166188class PyLocalsTests (DebuggerTests ):
167189 @unittest .skipIf (python_is_optimized (),
0 commit comments