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):
375375 some_fig ["layout_template_layout_plot_bgcolor" ] = 1
376376 except ValueError as e :
377377 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 :]
385388 e_correct_substr += """
386389
387390Property does not support subscripting:
@@ -399,6 +402,7 @@ def test_described_subscript_error_on_type_error(some_fig):
399402 """string indices must be integers
400403
401404Invalid value received for the 'plot_bgcolor' property of layout
405+
402406""" ,
403407 )
404408 assert e_substr == e_correct_substr
You can’t perform that action at this time.
0 commit comments