File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
packages/python/plotly/plotly/tests/test_core/test_errors Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -375,13 +375,16 @@ def test_described_subscript_error_on_type_error(some_fig):
375
375
some_fig ["layout_template_layout_plot_bgcolor" ] = 1
376
376
except ValueError as e :
377
377
raised = True
378
- e_correct_substr = error_substr (
379
- e .args [0 ],
380
- """
381
- Invalid value of type 'builtins.int' received for the 'plot_bgcolor' property of layout
382
- Received value: 1
383
- """ ,
384
- )
378
+ # Trim off the beginning of the error string because it is related to
379
+ # trying to assign a number to something expecting a string, whereas
380
+ # below the error will be due to trying to subscript something that
381
+ # doesn't support it. But the list of valid properties should be shown
382
+ # for both errors and this is what we extract.
383
+ # Trimmed like this because this string is different in Python2 than
384
+ # Python3
385
+ e_correct_substr = e .args [0 ]
386
+ start_at = e_correct_substr .find (" The 'plot_bgcolor'" )
387
+ e_correct_substr = e_correct_substr [start_at :]
385
388
e_correct_substr += """
386
389
387
390
Property does not support subscripting:
@@ -399,6 +402,7 @@ def test_described_subscript_error_on_type_error(some_fig):
399
402
"""string indices must be integers
400
403
401
404
Invalid value received for the 'plot_bgcolor' property of layout
405
+
402
406
""" ,
403
407
)
404
408
assert e_substr == e_correct_substr
You can’t perform that action at this time.
0 commit comments