Skip to content

Commit f8dcb84

Browse files
committed
added tests for fix of issue pandas-dev#16953
1 parent 84a8cc2 commit f8dcb84

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

pandas/tests/plotting/test_frame.py

+19
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,25 @@ def test_subplots_timeseries(self):
380380
self._check_ticks_props(ax, xlabelsize=7, xrot=45,
381381
ylabelsize=7)
382382

383+
def test_subplots_timeseries_y_axis(self):
384+
# tests for fix of issue #16953
385+
testdata = DataFrame({"numeric": np.array([1, 2, 5]),
386+
"timedelta": [pd.Timedelta(10, unit="s"),
387+
pd.Timedelta(10, unit="m"),
388+
pd.Timedelta(10, unit="h")],
389+
"datetime": [pd.to_datetime("2017-08-01 00:00:00"),
390+
pd.to_datetime("2017-08-01 02:00:00"),
391+
pd.to_datetime("2017-08-02 00:00:00")],
392+
"text": ["This", "should", "fail"]})
393+
ax_numeric = testdata.plot(y="numeric")
394+
assert (ax_numeric.get_lines()[0].get_data()[1] == testdata["numeric"].values).all()
395+
ax_timedelta = testdata.plot(y="timedelta")
396+
assert (ax_timedelta.get_lines()[0].get_data()[1] == testdata["timedelta"].values).all()
397+
ax_datetime = testdata.plot(y="datetime")
398+
assert (ax_datetime.get_lines()[0].get_data()[1] == testdata["datetime"].values).all()
399+
with pytest.raises(TypeError):
400+
testdata.plot(y="text")
401+
383402
@pytest.mark.slow
384403
def test_subplots_layout(self):
385404
# GH 6667

0 commit comments

Comments
 (0)