File tree 2 files changed +22
-4
lines changed 2 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -1274,7 +1274,14 @@ def set_xdata(self, x):
1274
1274
x : 1D array
1275
1275
"""
1276
1276
if not np .iterable (x ):
1277
- raise RuntimeError ('x must be a sequence' )
1277
+ # When deprecation cycle is completed
1278
+ # raise RuntimeError('x must be a sequence')
1279
+ _api .warn_deprecated (
1280
+ since = 3.7 ,
1281
+ message = "Setting data with a non sequence type "
1282
+ "is deprecated since %(since)s and will be "
1283
+ "remove %(removal)s" )
1284
+ x = [x , ]
1278
1285
self ._xorig = copy .copy (x )
1279
1286
self ._invalidx = True
1280
1287
self .stale = True
@@ -1288,7 +1295,14 @@ def set_ydata(self, y):
1288
1295
y : 1D array
1289
1296
"""
1290
1297
if not np .iterable (y ):
1291
- raise RuntimeError ('y must be a sequence' )
1298
+ # When deprecation cycle is completed
1299
+ # raise RuntimeError('y must be a sequence')
1300
+ _api .warn_deprecated (
1301
+ since = 3.7 ,
1302
+ message = "Setting data with a non sequence type "
1303
+ "is deprecated since %(since)s and will be "
1304
+ "remove %(removal)s" )
1305
+ y = [y , ]
1292
1306
self ._yorig = copy .copy (y )
1293
1307
self ._invalidy = True
1294
1308
self .stale = True
Original file line number Diff line number Diff line change 20
20
import matplotlib .pyplot as plt
21
21
import matplotlib .transforms as mtransforms
22
22
from matplotlib .testing .decorators import image_comparison , check_figures_equal
23
+ from matplotlib ._api .deprecation import MatplotlibDeprecationWarning
23
24
24
25
25
26
def test_segment_hits ():
@@ -91,9 +92,12 @@ def test_invalid_line_data():
91
92
mlines .Line2D ([], 1 )
92
93
93
94
line = mlines .Line2D ([], [])
94
- with pytest .raises (RuntimeError , match = 'x must be' ):
95
+ # when deprecation cycle is completed
96
+ # with pytest.raises(RuntimeError, match='x must be'):
97
+ with pytest .warns (MatplotlibDeprecationWarning ):
95
98
line .set_xdata (0 )
96
- with pytest .raises (RuntimeError , match = 'y must be' ):
99
+ # with pytest.raises(RuntimeError, match='y must be'):
100
+ with pytest .warns (MatplotlibDeprecationWarning ):
97
101
line .set_ydata (0 )
98
102
99
103
You can’t perform that action at this time.
0 commit comments