Skip to content

Commit a802f9d

Browse files
nicholas-esterernicolaskruchten
authored andcommitted
Integer selector tested on select_* elements over subplots
e.g., select_xaxes
1 parent 9fae7a4 commit a802f9d

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

Diff for: packages/python/plotly/plotly/tests/test_core/test_update_objects/test_update_subplots.py

+32
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ def test_select_by_type_and_selector(self):
152152
"xaxis", "xaxes", [], selector={"title.text": "C"}, test_no_grid=True
153153
)
154154

155+
self.assert_select_subplots(
156+
"xaxis", "xaxes", [4], selector=-1, test_no_grid=True
157+
)
158+
155159
# yaxis
156160
self.assert_select_subplots(
157161
"yaxis", "yaxes", [1, 3], selector={"title.text": "A"}, test_no_grid=True
@@ -165,6 +169,14 @@ def test_select_by_type_and_selector(self):
165169
"yaxis", "yaxes", [], selector={"title.text": "C"}, test_no_grid=True
166170
)
167171

172+
self.assert_select_subplots(
173+
"yaxis", "yaxes", [5], selector=-1, test_no_grid=True
174+
)
175+
176+
self.assert_select_subplots(
177+
"yaxis", "yaxes", [2], selector=1, test_no_grid=True
178+
)
179+
168180
# scene
169181
self.assert_select_subplots(
170182
"scene",
@@ -190,6 +202,10 @@ def test_select_by_type_and_selector(self):
190202
test_no_grid=True,
191203
)
192204

205+
self.assert_select_subplots(
206+
"scene", "scenes", [1], selector=0, test_no_grid=True
207+
)
208+
193209
# polar
194210
self.assert_select_subplots(
195211
"polar",
@@ -215,6 +231,10 @@ def test_select_by_type_and_selector(self):
215231
test_no_grid=True,
216232
)
217233

234+
self.assert_select_subplots(
235+
"polar", "polars", [2], selector=-1, test_no_grid=True
236+
)
237+
218238
# ternary
219239
self.assert_select_subplots(
220240
"ternary",
@@ -240,6 +260,10 @@ def test_select_by_type_and_selector(self):
240260
test_no_grid=True,
241261
)
242262

263+
self.assert_select_subplots(
264+
"ternary", "ternaries", [1], selector=-1, test_no_grid=True
265+
)
266+
243267
# No 'geo' or 'mapbox' subplots initialized, but the first subplot
244268
# object is always present
245269
self.assert_select_subplots(
@@ -272,6 +296,8 @@ def test_select_by_type_and_grid_and_selector(self):
272296
"xaxis", "xaxes", [3, 4], col=1, selector={"title.text": "B"}
273297
)
274298

299+
self.assert_select_subplots("xaxis", "xaxes", [4], col=1, selector=-1)
300+
275301
self.assert_select_subplots(
276302
"xaxis", "xaxes", [3], row=2, selector={"title.text": "B"}
277303
)
@@ -285,6 +311,10 @@ def test_select_by_type_and_grid_and_selector(self):
285311
"yaxis", "yaxes", [1, 3], col=1, selector={"title.text": "A"}
286312
)
287313

314+
self.assert_select_subplots("yaxis", "yaxes", [5], col=1, selector=-1)
315+
316+
self.assert_select_subplots("yaxis", "yaxes", [1], col=1, selector=0)
317+
288318
self.assert_select_subplots(
289319
"yaxis", "yaxes", [4], col=1, selector={"title.text": "B"}
290320
)
@@ -294,6 +324,8 @@ def test_select_by_type_and_grid_and_selector(self):
294324
"polar", "polars", [1, 2], row=2, selector={"angularaxis.rotation": 45}
295325
)
296326

327+
self.assert_select_subplots("polar", "polars", [2], row=2, selector=-1)
328+
297329
self.assert_select_subplots(
298330
"polar", "polars", [1], col=2, selector={"angularaxis.rotation": 45}
299331
)

0 commit comments

Comments
 (0)