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

Function test_date_numpyx

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

Source from the content-addressed store, hash-verified

14
15
16def test_date_numpyx():
17 # test that numpy dates work properly...
18 base = datetime.datetime(2017, 1, 1)
19 time = [base + datetime.timedelta(days=x) for x in range(0, 3)]
20 timenp = np.array(time, dtype='datetime64[ns]')
21 data = np.array([0., 2., 1.])
22 fig = plt.figure(figsize=(10, 2))
23 ax = fig.add_subplot(1, 1, 1)
24 h, = ax.plot(time, data)
25 hnp, = ax.plot(timenp, data)
26 np.testing.assert_equal(h.get_xdata(orig=False), hnp.get_xdata(orig=False))
27 fig = plt.figure(figsize=(10, 2))
28 ax = fig.add_subplot(1, 1, 1)
29 h, = ax.plot(data, time)
30 hnp, = ax.plot(data, timenp)
31 np.testing.assert_equal(h.get_ydata(orig=False), hnp.get_ydata(orig=False))
32
33
34@pytest.mark.parametrize('t0', [datetime.datetime(2017, 1, 1, 0, 1, 1),

Callers

nothing calls this directly

Calls 5

figureMethod · 0.80
add_subplotMethod · 0.80
plotMethod · 0.45
get_xdataMethod · 0.45
get_ydataMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…