@@ -43,7 +43,7 @@ def test_raises_on_bad_dot_property(some_fig):
43
43
raised = False
44
44
try :
45
45
x2000 = some_fig ["layout.shapes[1].x2000" ]
46
- except ValueError as e :
46
+ except KeyError as e :
47
47
raised = True
48
48
assert (
49
49
e .args [0 ].find (
@@ -62,7 +62,7 @@ def test_raises_on_bad_ancestor_dot_property(some_fig):
62
62
raised = False
63
63
try :
64
64
x2000 = some_fig ["layout.shapa[1].x2000" ]
65
- except ValueError as e :
65
+ except KeyError as e :
66
66
raised = True
67
67
assert (
68
68
e .args [0 ].find (
@@ -91,7 +91,7 @@ def test_raises_on_bad_indexed_underscore_property(some_fig):
91
91
try :
92
92
# get the error without using a path-like key, we compare with this error
93
93
some_fig .data [0 ].line ["colr" ] = "blue"
94
- except ValueError as e_correct :
94
+ except KeyError as e_correct :
95
95
raised = True
96
96
# remove "Bad property path:
97
97
e_correct_substr = error_substr (
@@ -109,7 +109,7 @@ def test_raises_on_bad_indexed_underscore_property(some_fig):
109
109
raised = False
110
110
try :
111
111
some_fig ["data[0].line_colr" ] = "blue"
112
- except ValueError as e :
112
+ except KeyError as e :
113
113
raised = True
114
114
e_substr = error_substr (
115
115
e .args [0 ],
@@ -135,7 +135,7 @@ def test_raises_on_bad_indexed_underscore_property(some_fig):
135
135
try :
136
136
# get the error without using a path-like key
137
137
some_fig .add_trace (go .Scatter (x = [1 , 2 ], y = [3 , 4 ], line = dict (colr = "blue" )))
138
- except ValueError as e_correct :
138
+ except KeyError as e_correct :
139
139
raised = True
140
140
e_correct_substr = error_substr (
141
141
e_correct .args [0 ],
@@ -152,7 +152,7 @@ def test_raises_on_bad_indexed_underscore_property(some_fig):
152
152
# the path
153
153
try :
154
154
some_fig .add_trace (go .Scatter (x = [1 , 2 ], y = [3 , 4 ], line_colr = "blue" ))
155
- except ValueError as e :
155
+ except KeyError as e :
156
156
raised = True
157
157
e_substr = error_substr (
158
158
e .args [0 ],
@@ -180,7 +180,7 @@ def test_raises_on_bad_indexed_underscore_property(some_fig):
180
180
# the path
181
181
try :
182
182
fig2 = go .Figure (layout = dict (title = dict (txt = "two" )))
183
- except ValueError as e_correct :
183
+ except KeyError as e_correct :
184
184
raised = True
185
185
e_correct_substr = error_substr (
186
186
e_correct .args [0 ],
@@ -196,9 +196,9 @@ def test_raises_on_bad_indexed_underscore_property(some_fig):
196
196
fig2 = go .Figure (layout_title_txt = "two" )
197
197
except TypeError as e :
198
198
raised = True
199
- # when the Figure constructor sees the same ValueError above, a
199
+ # when the Figure constructor sees the same KeyError above, a
200
200
# TypeError is raised and adds an error message in front of the same
201
- # ValueError thrown above
201
+ # KeyError thrown above
202
202
e_substr = error_substr (
203
203
e .args [0 ],
204
204
"""
@@ -230,7 +230,7 @@ def test_raises_on_bad_indexed_underscore_property(some_fig):
230
230
# works when the bad part is not the last part in the path
231
231
try :
232
232
some_fig .update_layout (geo = dict (ltaxis = dict (showgrid = True )))
233
- except ValueError as e_correct :
233
+ except KeyError as e_correct :
234
234
raised = True
235
235
e_correct_substr = error_substr (
236
236
e_correct .args [0 ],
@@ -244,7 +244,7 @@ def test_raises_on_bad_indexed_underscore_property(some_fig):
244
244
raised = False
245
245
try :
246
246
some_fig .update_layout (geo_ltaxis_showgrid = True )
247
- except ValueError as e :
247
+ except KeyError as e :
248
248
raised = True
249
249
e_substr = error_substr (
250
250
e .args [0 ],
0 commit comments