File tree 1 file changed +27
-0
lines changed
packages/python/plotly/plotly/tests/test_core/test_graph_objs
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 1
1
from unittest import TestCase
2
+ import warnings
2
3
3
4
import plotly .graph_objs as go
4
5
@@ -154,3 +155,29 @@ def test_pop_invalid_prop_key_error(self):
154
155
155
156
def test_pop_invalid_prop_with_default (self ):
156
157
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 ()])
You can’t perform that action at this time.
0 commit comments