MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_change_converter

Function test_change_converter

lib/matplotlib/tests/test_dates.py:1263–1281  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1261
1262
1263def test_change_converter():
1264 plt.rcParams['date.converter'] = 'concise'
1265 dates = np.arange('2020-01-01', '2020-05-01', dtype='datetime64[D]')
1266 fig, ax = plt.subplots()
1267
1268 ax.plot(dates, np.arange(len(dates)))
1269 fig.canvas.draw()
1270 assert ax.get_xticklabels()[0].get_text() == 'Jan'
1271 assert ax.get_xticklabels()[1].get_text() == '15'
1272
1273 plt.rcParams['date.converter'] = 'auto'
1274 fig, ax = plt.subplots()
1275
1276 ax.plot(dates, np.arange(len(dates)))
1277 fig.canvas.draw()
1278 assert ax.get_xticklabels()[0].get_text() == 'Jan 01 2020'
1279 assert ax.get_xticklabels()[1].get_text() == 'Jan 15 2020'
1280 with pytest.raises(ValueError):
1281 plt.rcParams['date.converter'] = 'boo'
1282
1283
1284def test_change_interval_multiples():

Callers

nothing calls this directly

Calls 4

subplotsMethod · 0.45
plotMethod · 0.45
drawMethod · 0.45
get_textMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…