@@ -48,9 +48,12 @@ def compare(self, vf):
48
48
# py3 compat when reading py2 pickle
49
49
try :
50
50
data = pandas .read_pickle (vf )
51
- except (ValueError ) as detail :
52
- # trying to read a py3 pickle in py2
53
- return
51
+ except (ValueError ) as e :
52
+ if 'unsupported pickle protocol:' in str (e ):
53
+ # trying to read a py3 pickle in py2
54
+ return
55
+ else :
56
+ raise
54
57
55
58
for typ , dv in data .items ():
56
59
for dt , result in dv .items ():
@@ -60,6 +63,7 @@ def compare(self, vf):
60
63
continue
61
64
62
65
self .compare_element (typ , result , expected )
66
+ return data
63
67
64
68
def read_pickles (self , version ):
65
69
if not is_little_endian ():
@@ -68,7 +72,14 @@ def read_pickles(self, version):
68
72
pth = tm .get_data_path ('legacy_pickle/{0}' .format (str (version )))
69
73
for f in os .listdir (pth ):
70
74
vf = os .path .join (pth ,f )
71
- self .compare (vf )
75
+ data = self .compare (vf )
76
+
77
+ if data is None :
78
+ continue
79
+
80
+ if 'series' in data :
81
+ if 'ts' in data ['series' ]:
82
+ self ._validate_timeseries (data ['series' ]['ts' ], self .data ['series' ]['ts' ])
72
83
73
84
def test_read_pickles_0_10_1 (self ):
74
85
self .read_pickles ('0.10.1' )
@@ -82,6 +93,9 @@ def test_read_pickles_0_12_0(self):
82
93
def test_read_pickles_0_13_0 (self ):
83
94
self .read_pickles ('0.13.0' )
84
95
96
+ def test_read_pickles_0_14_0 (self ):
97
+ self .read_pickles ('0.14.0' )
98
+
85
99
def test_round_trip_current (self ):
86
100
for typ , dv in self .data .items ():
87
101
@@ -94,6 +108,14 @@ def test_round_trip_current(self):
94
108
result = pd .read_pickle (path )
95
109
self .compare_element (typ , result , expected )
96
110
111
+ def _validate_timeseries (self , pickled , current ):
112
+ # GH 7748
113
+ tm .assert_series_equal (pickled , current )
114
+ self .assertEqual (pickled .index .freq , current .index .freq )
115
+ self .assertEqual (pickled .index .freq .normalize , False )
116
+ self .assert_numpy_array_equal (pickled > 0 , current > 0 )
117
+
118
+
97
119
if __name__ == '__main__' :
98
120
import nose
99
121
nose .runmodule (argv = [__file__ , '-vvs' , '-x' , '--pdb' , '--pdb-failure' ],
0 commit comments