@@ -43,7 +43,7 @@ def test_raises_on_bad_dot_property(some_fig):
4343 raised = False
4444 try :
4545 x2000 = some_fig ["layout.shapes[1].x2000" ]
46- except ValueError as e :
46+ except KeyError as e :
4747 raised = True
4848 assert (
4949 e .args [0 ].find (
@@ -62,7 +62,7 @@ def test_raises_on_bad_ancestor_dot_property(some_fig):
6262 raised = False
6363 try :
6464 x2000 = some_fig ["layout.shapa[1].x2000" ]
65- except ValueError as e :
65+ except KeyError as e :
6666 raised = True
6767 assert (
6868 e .args [0 ].find (
@@ -91,7 +91,7 @@ def test_raises_on_bad_indexed_underscore_property(some_fig):
9191 try :
9292 # get the error without using a path-like key, we compare with this error
9393 some_fig .data [0 ].line ["colr" ] = "blue"
94- except ValueError as e_correct :
94+ except KeyError as e_correct :
9595 raised = True
9696 # remove "Bad property path:
9797 e_correct_substr = error_substr (
@@ -109,7 +109,7 @@ def test_raises_on_bad_indexed_underscore_property(some_fig):
109109 raised = False
110110 try :
111111 some_fig ["data[0].line_colr" ] = "blue"
112- except ValueError as e :
112+ except KeyError as e :
113113 raised = True
114114 e_substr = error_substr (
115115 e .args [0 ],
@@ -135,7 +135,7 @@ def test_raises_on_bad_indexed_underscore_property(some_fig):
135135 try :
136136 # get the error without using a path-like key
137137 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 :
139139 raised = True
140140 e_correct_substr = error_substr (
141141 e_correct .args [0 ],
@@ -152,7 +152,7 @@ def test_raises_on_bad_indexed_underscore_property(some_fig):
152152 # the path
153153 try :
154154 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 :
156156 raised = True
157157 e_substr = error_substr (
158158 e .args [0 ],
@@ -180,7 +180,7 @@ def test_raises_on_bad_indexed_underscore_property(some_fig):
180180 # the path
181181 try :
182182 fig2 = go .Figure (layout = dict (title = dict (txt = "two" )))
183- except ValueError as e_correct :
183+ except KeyError as e_correct :
184184 raised = True
185185 e_correct_substr = error_substr (
186186 e_correct .args [0 ],
@@ -196,9 +196,9 @@ def test_raises_on_bad_indexed_underscore_property(some_fig):
196196 fig2 = go .Figure (layout_title_txt = "two" )
197197 except TypeError as e :
198198 raised = True
199- # when the Figure constructor sees the same ValueError above, a
199+ # when the Figure constructor sees the same KeyError above, a
200200 # TypeError is raised and adds an error message in front of the same
201- # ValueError thrown above
201+ # KeyError thrown above
202202 e_substr = error_substr (
203203 e .args [0 ],
204204 """
@@ -230,7 +230,7 @@ def test_raises_on_bad_indexed_underscore_property(some_fig):
230230 # works when the bad part is not the last part in the path
231231 try :
232232 some_fig .update_layout (geo = dict (ltaxis = dict (showgrid = True )))
233- except ValueError as e_correct :
233+ except KeyError as e_correct :
234234 raised = True
235235 e_correct_substr = error_substr (
236236 e_correct .args [0 ],
@@ -244,7 +244,7 @@ def test_raises_on_bad_indexed_underscore_property(some_fig):
244244 raised = False
245245 try :
246246 some_fig .update_layout (geo_ltaxis_showgrid = True )
247- except ValueError as e :
247+ except KeyError as e :
248248 raised = True
249249 e_substr = error_substr (
250250 e .args [0 ],
0 commit comments