Skip to content

Commit d1e475d

Browse files
committed
TST: Add test pickling plot with DatetimeIndex
1 parent 4611140 commit d1e475d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pandas/tests/plotting/test_datetimelike.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
""" Test cases for time series specific (freq conversion, etc) """
22

33
from datetime import datetime, timedelta, date, time
4+
import pickle
45

56
import pytest
67
from pandas.compat import lrange, zip
78

89
import numpy as np
910
from pandas import Index, Series, DataFrame, NaT
10-
from pandas.compat import is_platform_mac
11+
from pandas.compat import is_platform_mac, PY3
1112
from pandas.core.indexes.datetimes import date_range, bdate_range
1213
from pandas.core.indexes.timedeltas import timedelta_range
1314
from pandas.tseries.offsets import DateOffset
@@ -1470,5 +1471,12 @@ def _check_plot_works(f, freq=None, series=None, *args, **kwargs):
14701471

14711472
with ensure_clean(return_filelike=True) as path:
14721473
plt.savefig(path)
1474+
1475+
# GH18439
1476+
# this is supported only in Python 3 pickle since
1477+
# pickle in Python2 doesn't support instancemethod pickling
1478+
if PY3:
1479+
with ensure_clean(return_filelike=True) as path:
1480+
pickle.dump(fig, path)
14731481
finally:
14741482
plt.close(fig)

0 commit comments

Comments
 (0)