()
| 14 | |
| 15 | |
| 16 | def 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), |
nothing calls this directly
no test coverage detected
searching dependent graphs…