@@ -71,6 +71,12 @@ def test_two_abs_args(self):
71
71
from _testcapi import pyobject_vectorcall
72
72
73
73
def 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}}
74
80
bar(a, b, c)
75
81
76
82
def bar(a, b, c):
@@ -94,7 +100,7 @@ def test_pyup_command(self):
94
100
cmds_after_breakpoint = ['py-up' , 'py-up' ])
95
101
self .assertMultilineMatches (bt ,
96
102
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\)\)
98
104
#[0-9]+ <built-in method pyobject_vectorcall of module object at remote 0x[0-9a-f]+>
99
105
$''' )
100
106
@@ -123,9 +129,9 @@ def test_up_then_down(self):
123
129
cmds_after_breakpoint = ['py-up' , 'py-up' , 'py-down' ])
124
130
self .assertMultilineMatches (bt ,
125
131
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\)\)
127
133
#[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\)\)
129
135
$''' )
130
136
131
137
class PyPrintTests (DebuggerTests ):
@@ -162,6 +168,22 @@ def test_printing_builtin(self):
162
168
cmds_after_breakpoint = ['py-up' , 'py-print len' ])
163
169
self .assertMultilineMatches (bt ,
164
170
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
+ ''' )
165
187
166
188
class PyLocalsTests (DebuggerTests ):
167
189
@unittest .skipIf (python_is_optimized (),
0 commit comments