1
1
import plotly .graph_objects as go
2
- from _plotly_utils .exceptions import PlotlyKeyError
3
2
import pytest
4
3
import sys
5
4
@@ -23,7 +22,7 @@ def test_raises_on_bad_index(some_fig):
23
22
# Check indexing errors can be detected when path used as key to go.Figure
24
23
raised = False
25
24
try :
26
- x0 = some_fig ["layout.shapes[2].x0" ]
25
+ some_fig ["layout.shapes[2].x0" ]
27
26
except KeyError as e :
28
27
raised = True
29
28
assert (
@@ -43,7 +42,7 @@ def test_raises_on_bad_dot_property(some_fig):
43
42
# go.Figure
44
43
raised = False
45
44
try :
46
- x2000 = some_fig ["layout.shapes[1].x2000" ]
45
+ some_fig ["layout.shapes[1].x2000" ]
47
46
except KeyError as e :
48
47
raised = True
49
48
assert (
@@ -62,7 +61,7 @@ def test_raises_on_bad_ancestor_dot_property(some_fig):
62
61
# Check . property lookup errors but not on the last part of the path
63
62
raised = False
64
63
try :
65
- x2000 = some_fig ["layout.shapa[1].x2000" ]
64
+ some_fig ["layout.shapa[1].x2000" ]
66
65
except KeyError as e :
67
66
raised = True
68
67
assert (
@@ -181,7 +180,7 @@ def test_raises_on_bad_indexed_underscore_property(some_fig):
181
180
# BaseFigure and throws the error for the last good property found in
182
181
# the path
183
182
try :
184
- fig2 = go .Figure (layout = dict (title = dict (txt = "two" )))
183
+ go .Figure (layout = dict (title = dict (txt = "two" )))
185
184
except ValueError as e_correct :
186
185
raised = True
187
186
e_correct_substr = error_substr (
@@ -195,7 +194,7 @@ def test_raises_on_bad_indexed_underscore_property(some_fig):
195
194
196
195
raised = False
197
196
try :
198
- fig2 = go .Figure (layout_title_txt = "two" )
197
+ go .Figure (layout_title_txt = "two" )
199
198
except TypeError as e :
200
199
raised = True
201
200
# when the Figure constructor sees the same ValueError above, a
@@ -421,14 +420,14 @@ def test_subscript_error_exception_types(some_fig):
421
420
with pytest .raises (ValueError ):
422
421
some_fig .update_layout (width_yo = 100 )
423
422
with pytest .raises (KeyError ):
424
- yo = some_fig ["layout_width_yo" ]
423
+ some_fig ["layout_width_yo" ]
425
424
426
425
some_fig .update_layout (width = 100 )
427
426
# when width is specified
428
427
with pytest .raises (ValueError ):
429
428
some_fig .update_layout (width_yo = 100 )
430
429
with pytest .raises (KeyError ):
431
- yo = some_fig ["layout_width_yo" ]
430
+ some_fig ["layout_width_yo" ]
432
431
433
432
434
433
def form_error_string (call , exception , subs ):
0 commit comments