Skip to content

Commit 3fcaa94

Browse files
committed
TST: separate test
1 parent 401a287 commit 3fcaa94

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

xarray/tests/test_plot.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
from datetime import datetime
55
from typing import Any, Dict, Union
66

7-
import matplotlib
8-
97
import numpy as np
108
import pandas as pd
119
import pytest
@@ -2670,11 +2668,14 @@ def setUp(self):
26702668

26712669
def test_datetime_line_plot(self):
26722670
# test if line plot raises no Exception
2671+
self.darray.plot.line()
2672+
2673+
def test_datetime_units(self):
2674+
# test that matplotlib-native datetime works:
26732675
fig, ax = plt.subplots()
2674-
self.darray.plot.line(ax=ax)
2675-
# check that motplotlib's datetlocator has been chosen
2676-
loc = ax.xaxis.get_major_locator()
2677-
assert isinstance(loc, matplotlib.dates.AutoDateLocator)
2676+
ax.plot(self.darray['time'], self.darray)
2677+
assert isinstance(ax.xaxis.get_major_locator(),
2678+
mpl.dates.AutoDateLocator)
26782679

26792680

26802681
@pytest.mark.filterwarnings("ignore:setting an array element with a sequence")

0 commit comments

Comments
 (0)