@@ -208,17 +208,19 @@ def test_plot(str_expr, msgs, str_expected, fail_msg):
208208
209209#
210210# Call plotting functions and examine the structure of the output
211+ # In case of error trees are printed with an embedded >>> marker showing location of error
211212#
212213
214+ def print_expression_tree_with_marker (expr ):
215+ print_expression_tree (expr , marker = lambda expr : getattr (expr , "_marker" , "" ))
216+
217+
213218def check_structure (result , expected ):
214219 """Check that expected is a prefix of result at every node"""
215220
216221 def error (msg ):
217- print (f"\n ERROR: { msg } " , file = sys .stderr )
218- print ("=== result:" )
219- print_expression_tree (result )
220- print ("=== expected:" )
221- print_expression_tree (expected )
222+ result ._marker = "RESULT >>> "
223+ expected ._marker = "EXPECTED >>> "
222224 raise AssertionError (msg )
223225
224226 # do the heads match?
@@ -242,8 +244,16 @@ def eval_and_check_structure(str_expr, str_expected):
242244 expr = session .parse (str_expr )
243245 result = expr .evaluate (session .evaluation )
244246 expected = session .parse (str_expected )
245- check_structure (result , expected )
246-
247+ try :
248+ check_structure (result , expected )
249+ except AssertionError as oops :
250+ print (f"\n ERROR: { oops } (error is marked with >>>)" )
251+ print ("=== result:" )
252+ print_expression_tree_with_marker (result )
253+ print ("=== expected:" )
254+ print_expression_tree_with_marker (expected )
255+ raise
256+
247257
248258def test_plot3d_default ():
249259 eval_and_check_structure (
@@ -261,9 +271,9 @@ def test_plot3d_default():
261271 Polygon[{{0.0,0.0,0.0}, {0.0,0.5,0.5}, {0.5,0.0,0.5}}],
262272 Polygon[{{}}]
263273 },
264- AspectRatio -> 1,
274+ XAspectRatio -> 1,
265275 Axes -> True,
266- XAxesStyle -> {},
276+ AxesStyle -> {},
267277 Background -> Automatic,
268278 BoxRatios -> {1, 1, 0.4},
269279 ImageSize -> Automatic,
0 commit comments