Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 553d6ac

Browse files
committed
tests for deprecation warnings in graph_objects
1 parent 5d113b9 commit 553d6ac

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_graph_objs.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from unittest import TestCase
2+
import warnings
23

34
import plotly.graph_objs as go
45

@@ -154,3 +155,29 @@ def test_pop_invalid_prop_key_error(self):
154155

155156
def test_pop_invalid_prop_with_default(self):
156157
self.assertEqual(self.layout.pop("bogus", 42), 42)
158+
159+
160+
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 warning
164+
for trace_constructor in [
165+
go.Scattermapbox,
166+
go.Densitymapbox,
167+
go.Choroplethmapbox,
168+
]:
169+
with self.assertWarns(DeprecationWarning):
170+
_ = go.Figure([trace_constructor()])
171+
172+
def test_no_warn_on_other_traces(self):
173+
# This test will fail if any of the following traces emits a warning
174+
for trace_constructor in [
175+
go.Scatter,
176+
go.Bar,
177+
go.Scattermap,
178+
go.Densitymap,
179+
go.Choroplethmap,
180+
]:
181+
with warnings.catch_warnings():
182+
warnings.simplefilter("error")
183+
_ = go.Figure([trace_constructor()])

0 commit comments

Comments
 (0)