Skip to content

Commit 97b509f

Browse files
committed
update tests to remove mapbox references (change to map where relevant)
1 parent d57b4ae commit 97b509f

9 files changed

Lines changed: 20 additions & 61 deletions

File tree

tests/percy/compare-pandas.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@ def get_fig(html):
1616

1717
for filename in os.listdir("pandas2"):
1818
if filename not in [
19-
"density_mapbox.html",
2019
"density_map.html",
2120
"scatter_hover.html",
22-
"scatter_mapbox.html",
2321
"scatter_map.html",
2422
"line.html",
2523
"choropleth.html",
26-
"line_mapbox.html",
2724
"line_map.html",
2825
"scatter_log.html",
2926
]:

tests/test_core/test_graph_objs/test_frames.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,13 @@ def test_deeply_nested_data_attributes(self):
8282
self.assertEqual(
8383
set(matches),
8484
{
85-
"colorsrc",
8685
"autocolorscale",
8786
"cmin",
8887
"colorscale",
8988
"color",
9089
"reversescale",
9190
"width",
9291
"cauto",
93-
"widthsrc",
9492
"cmax",
9593
"coloraxis",
9694
},

tests/test_core/test_graph_objs/test_graph_objs.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from unittest import TestCase
22
import warnings
33

4-
import pytest
54
import plotly.graph_objs as go
65

76

@@ -158,17 +157,6 @@ def test_pop_invalid_prop_with_default(self):
158157

159158

160159
class TestDeprecationWarnings(TestCase):
161-
def test_warn_on_deprecated_mapbox_traces(self):
162-
# This test will fail if any of the following traces
163-
# fails to emit a DeprecationWarning
164-
for trace_constructor in [
165-
go.Scattermapbox,
166-
go.Densitymapbox,
167-
go.Choroplethmapbox,
168-
]:
169-
with pytest.warns(DeprecationWarning):
170-
_ = go.Figure([trace_constructor()])
171-
172160
def test_no_warn_on_non_deprecated_traces(self):
173161
# This test will fail if any of the following traces emits a DeprecationWarning
174162
for trace_constructor in [

tests/test_core/test_graph_objs/test_layout_subplots.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_initial_access_subplots(self):
2121
self.assertEqual(self.layout.yaxis, go.layout.YAxis())
2222
self.assertEqual(self.layout["geo"], go.layout.Geo())
2323
self.assertEqual(self.layout.scene, go.layout.Scene())
24-
self.assertEqual(self.layout.mapbox, go.layout.Mapbox())
24+
self.assertEqual(self.layout.map, go.layout.Map())
2525
self.assertEqual(self.layout.polar, go.layout.Polar())
2626

2727
# Subplot ids of 1 should be mapped to the same object as the base
@@ -30,7 +30,7 @@ def test_initial_access_subplots(self):
3030
self.assertIs(self.layout.yaxis, self.layout.yaxis1)
3131
self.assertIs(self.layout.geo, self.layout.geo1)
3232
self.assertIs(self.layout.scene, self.layout.scene1)
33-
self.assertIs(self.layout.mapbox, self.layout.mapbox1)
33+
self.assertIs(self.layout.map, self.layout.map1)
3434
self.assertIs(self.layout.polar, self.layout.polar1)
3535

3636
def test_initial_access_subplot2_1(self):
@@ -145,8 +145,8 @@ def test_subplot_objs_have_proper_type(self):
145145
self.layout.scene6 = {}
146146
self.assertIsInstance(self.layout.scene6, go.layout.Scene)
147147

148-
self.layout.mapbox7 = {}
149-
self.assertIsInstance(self.layout.mapbox7, go.layout.Mapbox)
148+
self.layout.map7 = {}
149+
self.assertIsInstance(self.layout.map7, go.layout.Map)
150150

151151
self.layout.polar8 = {}
152152
self.assertIsInstance(self.layout.polar8, go.layout.Polar)
@@ -162,7 +162,7 @@ def test_subplot_props_in_constructor(self):
162162
geo4=go.layout.Geo(bgcolor="blue"),
163163
ternary5=go.layout.Ternary(sum=120),
164164
scene6=go.layout.Scene(dragmode="zoom"),
165-
mapbox7=go.layout.Mapbox(zoom=2),
165+
map7=go.layout.Map(zoom=2),
166166
polar8=go.layout.Polar(sector=[0, 90]),
167167
)
168168

@@ -171,7 +171,7 @@ def test_subplot_props_in_constructor(self):
171171
self.assertEqual(layout.geo4.bgcolor, "blue")
172172
self.assertEqual(layout.ternary5.sum, 120)
173173
self.assertEqual(layout.scene6.dragmode, "zoom")
174-
self.assertEqual(layout.mapbox7.zoom, 2)
174+
self.assertEqual(layout.map7.zoom, 2)
175175
self.assertEqual(layout.polar8.sector, (0, 90))
176176

177177
def test_create_subplot_with_update(self):
@@ -182,7 +182,7 @@ def test_create_subplot_with_update(self):
182182
geo4=go.layout.Geo(bgcolor="blue"),
183183
ternary5=go.layout.Ternary(sum=120),
184184
scene6=go.layout.Scene(dragmode="zoom"),
185-
mapbox7=go.layout.Mapbox(zoom=2),
185+
map7=go.layout.Map(zoom=2),
186186
polar8=go.layout.Polar(sector=[0, 90]),
187187
)
188188

@@ -192,7 +192,7 @@ def test_create_subplot_with_update(self):
192192
self.assertEqual(self.layout.geo4.bgcolor, "blue")
193193
self.assertEqual(self.layout.ternary5.sum, 120)
194194
self.assertEqual(self.layout.scene6.dragmode, "zoom")
195-
self.assertEqual(self.layout.mapbox7.zoom, 2)
195+
self.assertEqual(self.layout.map7.zoom, 2)
196196
self.assertEqual(self.layout.polar8.sector, (0, 90))
197197

198198
def test_create_subplot_with_update_dict(self):
@@ -204,7 +204,7 @@ def test_create_subplot_with_update_dict(self):
204204
"geo4": {"bgcolor": "blue"},
205205
"ternary5": {"sum": 120},
206206
"scene6": {"dragmode": "zoom"},
207-
"mapbox7": {"zoom": 2},
207+
"map7": {"zoom": 2},
208208
"polar8": {"sector": [0, 90]},
209209
}
210210
)
@@ -215,7 +215,7 @@ def test_create_subplot_with_update_dict(self):
215215
self.assertEqual(self.layout.geo4.bgcolor, "blue")
216216
self.assertEqual(self.layout.ternary5.sum, 120)
217217
self.assertEqual(self.layout.scene6.dragmode, "zoom")
218-
self.assertEqual(self.layout.mapbox7.zoom, 2)
218+
self.assertEqual(self.layout.map7.zoom, 2)
219219
self.assertEqual(self.layout.polar8.sector, (0, 90))
220220

221221
def test_bug_1462(self):

tests/test_core/test_update_objects/test_update_subplots.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ def test_select_by_type(self):
109109

110110
self.assert_select_subplots("ternary", "ternaries", [1], test_no_grid=True)
111111

112-
# No 'geo' or 'mapbox' subplots initialized, but the first subplot
112+
# No 'geo' or 'map' subplots initialized, but the first subplot
113113
# object is always present
114114
self.assert_select_subplots("geo", "geos", [1], test_no_grid=True)
115115

116-
self.assert_select_subplots("mapbox", "mapboxes", [1], test_no_grid=True)
116+
self.assert_select_subplots("map", "maps", [1], test_no_grid=True)
117117

118118
def test_select_by_type_and_grid(self):
119119
self.assert_select_subplots("xaxis", "xaxes", [1, 2], row=1)
@@ -261,7 +261,7 @@ def test_select_by_type_and_selector(self):
261261
"ternary", "ternaries", [1], selector=-1, test_no_grid=True
262262
)
263263

264-
# No 'geo' or 'mapbox' subplots initialized, but the first subplot
264+
# No 'geo' or 'map' subplots initialized, but the first subplot
265265
# object is always present
266266
self.assert_select_subplots(
267267
"geo", "geos", [], selector={"bgcolor": "blue"}, test_no_grid=True
@@ -272,7 +272,7 @@ def test_select_by_type_and_selector(self):
272272
)
273273

274274
self.assert_select_subplots(
275-
"mapbox", "mapboxes", [], selector={"pitch": 45}, test_no_grid=True
275+
"map", "maps", [], selector={"pitch": 45}, test_no_grid=True
276276
)
277277

278278
def test_select_by_type_and_grid_and_selector(self):
@@ -421,14 +421,14 @@ def test_update_by_type(self):
421421
test_no_grid=True,
422422
)
423423

424-
# No 'geo' or 'mapbox' subplots initialized, but the first subplot
424+
# No 'geo' or 'map' subplots initialized, but the first subplot
425425
# object is always present
426426
self.assert_update_subplots(
427427
"geo", "geos", [1], {"bgcolor": "purple"}, test_no_grid=True
428428
)
429429

430430
self.assert_update_subplots(
431-
"mapbox", "mapboxes", [1], {"pitch": 99}, test_no_grid=True
431+
"map", "maps", [1], {"pitch": 99}, test_no_grid=True
432432
)
433433

434434
def test_update_by_type_and_grid(self):

tests/test_optional/test_figure_factory/test_figure_factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,7 @@ def test_optional_arguments(self):
11211121
assert len(fig.data) == ncontours + 2 + arg_set["showscale"]
11221122

11231123

1124-
class TestHexbinMapbox(NumpyTestUtilsMixin, TestCaseNoTemplate):
1124+
class TestHexbinMap(NumpyTestUtilsMixin, TestCaseNoTemplate):
11251125
def compare_list_values(self, list1, list2, decimal=7):
11261126
assert len(list1) == len(list2), "Lists are not of the same length."
11271127
for i in range(len(list1)):

tests/test_optional/test_graph_objs/test_skipped_b64_keys.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def test_np_geojson(self):
4141

4242
def test_np_layers(self):
4343
layout = {
44-
"mapbox": {
44+
"map": {
4545
"layers": [
4646
{
4747
"sourcetype": "geojson",
@@ -70,9 +70,9 @@ def test_np_layers(self):
7070

7171
fig = go.Figure(data=data, layout=layout)
7272

73-
assert (fig.layout["mapbox"]["layers"][0]["line"]["dash"] == (2.5, 1)).all()
73+
assert (fig.layout["map"]["layers"][0]["line"]["dash"] == (2.5, 1)).all()
7474

75-
assert json.loads(fig.to_json())["layout"]["mapbox"]["layers"][0]["source"][
75+
assert json.loads(fig.to_json())["layout"]["map"]["layers"][0]["source"][
7676
"features"
7777
][0]["geometry"]["coordinates"] == [[0.25, 52], [0.75, 50]]
7878

tests/test_optional/test_px/test_px.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -447,24 +447,6 @@ def test_load_px_data(return_type):
447447
assert len(df) > 0
448448

449449

450-
def test_warn_on_deprecated_mapbox_px_constructors():
451-
# This test will fail if any of the following px constructors
452-
# fails to emit a DeprecationWarning
453-
for fig_constructor in [
454-
px.line_mapbox,
455-
px.scatter_mapbox,
456-
px.density_mapbox,
457-
px.choropleth_mapbox,
458-
]:
459-
# Look for warnings with the string "_mapbox" in them
460-
# to make sure the warning is coming from px rather than go
461-
with pytest.warns(DeprecationWarning, match="_mapbox"):
462-
if fig_constructor == px.choropleth_mapbox:
463-
fig_constructor(locations=["CA", "TX", "NY"])
464-
else:
465-
fig_constructor(lat=[10, 20, 30], lon=[10, 20, 30])
466-
467-
468450
def test_no_warn_on_non_deprecated_px_constructors():
469451
# This test will fail if any of the following px constructors
470452
# emits a DeprecationWarning

tests/test_plotly_utils/validators/test_fig_deepcopy.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212

1313

1414
@pytest.mark.parametrize("return_type", ["pandas", "polars", "pyarrow"])
15-
@pytest.mark.filterwarnings(
16-
r"ignore:\*scattermapbox\* is deprecated! Use \*scattermap\* instead"
17-
)
1815
def test_deepcopy_dataframe(return_type):
1916
gapminder = px.data.gapminder(return_type=return_type)
2017
fig = px.line(gapminder, x="year", y="gdpPercap", color="country")
@@ -23,9 +20,6 @@ def test_deepcopy_dataframe(return_type):
2320
assert fig_copied.to_dict() == fig.to_dict()
2421

2522

26-
@pytest.mark.filterwarnings(
27-
r"ignore:\*scattermapbox\* is deprecated! Use \*scattermap\* instead"
28-
)
2923
def test_deepcopy_array():
3024
gapminder = px.data.gapminder()
3125
x = gapminder["year"].to_numpy()

0 commit comments

Comments
 (0)