Skip to content

Commit 22d9ad5

Browse files
author
Spencer Carrucciu
committed
move def test_round_trip_pickle to tseries.test.test_period.py
1 parent 81f76f2 commit 22d9ad5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pandas/tseries/tests/test_period.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
77
"""
88

9+
import pickle
10+
import os
11+
912
from datetime import datetime, date, timedelta
1013

1114
from numpy.ma.testutils import assert_equal
@@ -2537,6 +2540,16 @@ def test_searchsorted(self):
25372540
ValueError, 'Different period frequency: H',
25382541
lambda: pidx.searchsorted(pd.Period('2014-01-01', freq='H')))
25392542

2543+
def test_round_trip_pickle(self):
2544+
2545+
p = Period('2000Q1')
2546+
pickle_path = os.path.join(tm.get_data_path(),
2547+
'period.pickle')
2548+
2549+
with open(pickle_path, 'wb') as f: pickle.dump(p, f)
2550+
2551+
self.assertEqual(p, pd.read_pickle(pickle_path))
2552+
25402553
def _permute(obj):
25412554
return obj.take(np.random.permutation(len(obj)))
25422555

0 commit comments

Comments
 (0)