|
4 | 4 | import numpy as np
|
5 | 5 | import pandas as pd
|
6 | 6 | import pandas.util.testing as tm
|
7 |
| -import pytest |
8 | 7 | from pandas import DataFrame, MultiIndex, date_range
|
9 |
| -from pandas.compat import PY3, range |
10 |
| -from pandas.util.testing import assert_almost_equal |
| 8 | +from pandas.compat import range |
11 | 9 |
|
12 | 10 |
|
13 | 11 | def test_tolist(idx):
|
@@ -87,46 +85,6 @@ def test_to_hierarchical():
|
87 | 85 | assert result.names == index.names
|
88 | 86 |
|
89 | 87 |
|
90 |
| -@pytest.mark.skipif(PY3, reason="testing legacy pickles not support on py3") |
91 |
| -def test_legacy_pickle(datapath): |
92 |
| - |
93 |
| - path = datapath('indexes', 'multi', 'data', 'multiindex_v1.pickle') |
94 |
| - obj = pd.read_pickle(path) |
95 |
| - |
96 |
| - obj2 = MultiIndex.from_tuples(obj.values) |
97 |
| - assert obj.equals(obj2) |
98 |
| - |
99 |
| - res = obj.get_indexer(obj) |
100 |
| - exp = np.arange(len(obj), dtype=np.intp) |
101 |
| - assert_almost_equal(res, exp) |
102 |
| - |
103 |
| - res = obj.get_indexer(obj2[::-1]) |
104 |
| - exp = obj.get_indexer(obj[::-1]) |
105 |
| - exp2 = obj2.get_indexer(obj2[::-1]) |
106 |
| - assert_almost_equal(res, exp) |
107 |
| - assert_almost_equal(exp, exp2) |
108 |
| - |
109 |
| - |
110 |
| -def test_legacy_v2_unpickle(datapath): |
111 |
| - |
112 |
| - # 0.7.3 -> 0.8.0 format manage |
113 |
| - path = datapath('indexes', 'multi', 'data', 'mindex_073.pickle') |
114 |
| - obj = pd.read_pickle(path) |
115 |
| - |
116 |
| - obj2 = MultiIndex.from_tuples(obj.values) |
117 |
| - assert obj.equals(obj2) |
118 |
| - |
119 |
| - res = obj.get_indexer(obj) |
120 |
| - exp = np.arange(len(obj), dtype=np.intp) |
121 |
| - assert_almost_equal(res, exp) |
122 |
| - |
123 |
| - res = obj.get_indexer(obj2[::-1]) |
124 |
| - exp = obj.get_indexer(obj[::-1]) |
125 |
| - exp2 = obj2.get_indexer(obj2[::-1]) |
126 |
| - assert_almost_equal(res, exp) |
127 |
| - assert_almost_equal(exp, exp2) |
128 |
| - |
129 |
| - |
130 | 88 | def test_roundtrip_pickle_with_tz():
|
131 | 89 |
|
132 | 90 | # GH 8367
|
|
0 commit comments