|
1 | 1 | import pytest
|
2 |
| -import sys |
3 | 2 | import os
|
4 | 3 | import tempfile
|
5 | 4 | from contextlib import contextmanager
|
|
16 | 15 | date_range, timedelta_range, Index, DatetimeIndex,
|
17 | 16 | isna)
|
18 | 17 |
|
19 |
| -from pandas.compat import is_platform_windows, PY3, PY35, BytesIO, text_type |
| 18 | +from pandas.compat import (is_platform_windows, is_platform_little_endian, |
| 19 | + PY3, PY35, PY36, BytesIO, text_type) |
20 | 20 | from pandas.io.formats.printing import pprint_thing
|
21 | 21 | from pandas.core.dtypes.common import is_categorical_dtype
|
22 | 22 |
|
@@ -1042,11 +1042,10 @@ def check(format, index):
|
1042 | 1042 | with catch_warnings(record=True):
|
1043 | 1043 | check('fixed', index)
|
1044 | 1044 |
|
| 1045 | + @pytest.mark.skipif(not is_platform_little_endian(), |
| 1046 | + reason="reason platform is not little endian") |
1045 | 1047 | def test_encoding(self):
|
1046 | 1048 |
|
1047 |
| - if sys.byteorder != 'little': |
1048 |
| - pytest.skip('system byteorder is not little') |
1049 |
| - |
1050 | 1049 | with ensure_clean_store(self.path) as store:
|
1051 | 1050 | df = DataFrame(dict(A='foo', B='bar'), index=range(5))
|
1052 | 1051 | df.loc[2, 'A'] = np.nan
|
@@ -2887,9 +2886,6 @@ def test_index_types(self):
|
2887 | 2886 |
|
2888 | 2887 | def test_timeseries_preepoch(self):
|
2889 | 2888 |
|
2890 |
| - if sys.version_info[0] == 2 and sys.version_info[1] < 7: |
2891 |
| - pytest.skip("won't work on Python < 2.7") |
2892 |
| - |
2893 | 2889 | dr = bdate_range('1/1/1940', '1/1/1960')
|
2894 | 2890 | ts = Series(np.random.randn(len(dr)), index=dr)
|
2895 | 2891 | try:
|
@@ -4274,13 +4270,11 @@ def test_select_as_multiple(self):
|
4274 | 4270 | ['df1', 'df3'], where=['A>0', 'B>0'],
|
4275 | 4271 | selector='df1')
|
4276 | 4272 |
|
| 4273 | + @pytest.mark.skipf( |
| 4274 | + LooseVersion(tables.__version__) < '3.1.0', |
| 4275 | + "tables version does not support fix for nan selection bug: GH 4858") |
4277 | 4276 | def test_nan_selection_bug_4858(self):
|
4278 | 4277 |
|
4279 |
| - # GH 4858; nan selection bug, only works for pytables >= 3.1 |
4280 |
| - if LooseVersion(tables.__version__) < '3.1.0': |
4281 |
| - pytest.skip('tables version does not support fix for nan ' |
4282 |
| - 'selection bug: GH 4858') |
4283 |
| - |
4284 | 4278 | with ensure_clean_store(self.path) as store:
|
4285 | 4279 |
|
4286 | 4280 | df = DataFrame(dict(cols=range(6), values=range(6)),
|
@@ -4598,11 +4592,9 @@ def test_pytables_native_read(self):
|
4598 | 4592 | d2 = store['detector/readout']
|
4599 | 4593 | assert isinstance(d2, DataFrame)
|
4600 | 4594 |
|
| 4595 | + @pytest.mark.skipif(PY35 and is_platform_windows(), |
| 4596 | + reason="native2 read fails oddly on windows / 3.5") |
4601 | 4597 | def test_pytables_native2_read(self):
|
4602 |
| - # fails on win/3.5 oddly |
4603 |
| - if PY35 and is_platform_windows(): |
4604 |
| - pytest.skip("native2 read fails oddly on windows / 3.5") |
4605 |
| - |
4606 | 4598 | with ensure_clean_store(
|
4607 | 4599 | tm.get_data_path('legacy_hdf/pytables_native2.h5'),
|
4608 | 4600 | mode='r') as store:
|
@@ -4690,31 +4682,6 @@ def do_copy(f, new_f=None, keys=None,
|
4690 | 4682 | finally:
|
4691 | 4683 | safe_remove(path)
|
4692 | 4684 |
|
4693 |
| - def test_legacy_table_write(self): |
4694 |
| - pytest.skip("cannot write legacy tables") |
4695 |
| - |
4696 |
| - store = HDFStore(tm.get_data_path( |
4697 |
| - 'legacy_hdf/legacy_table_%s.h5' % pandas.__version__), 'a') |
4698 |
| - |
4699 |
| - df = tm.makeDataFrame() |
4700 |
| - with catch_warnings(record=True): |
4701 |
| - wp = tm.makePanel() |
4702 |
| - |
4703 |
| - index = MultiIndex(levels=[['foo', 'bar', 'baz', 'qux'], |
4704 |
| - ['one', 'two', 'three']], |
4705 |
| - labels=[[0, 0, 0, 1, 1, 2, 2, 3, 3, 3], |
4706 |
| - [0, 1, 2, 0, 1, 1, 2, 0, 1, 2]], |
4707 |
| - names=['foo', 'bar']) |
4708 |
| - df = DataFrame(np.random.randn(10, 3), index=index, |
4709 |
| - columns=['A', 'B', 'C']) |
4710 |
| - store.append('mi', df) |
4711 |
| - |
4712 |
| - df = DataFrame(dict(A='foo', B='bar'), index=lrange(10)) |
4713 |
| - store.append('df', df, data_columns=['B'], min_itemsize={'A': 200}) |
4714 |
| - store.append('wp', wp) |
4715 |
| - |
4716 |
| - store.close() |
4717 |
| - |
4718 | 4685 | def test_store_datetime_fractional_secs(self):
|
4719 | 4686 |
|
4720 | 4687 | with ensure_clean_store(self.path) as store:
|
@@ -5260,7 +5227,7 @@ def test_read_hdf_series_mode_r(self, format):
|
5260 | 5227 | result = pd.read_hdf(path, key='data', mode='r')
|
5261 | 5228 | tm.assert_series_equal(result, series)
|
5262 | 5229 |
|
5263 |
| - @pytest.mark.skipif(sys.version_info < (3, 6), reason="Need python 3.6") |
| 5230 | + @pytest.mark.skipif(not PY36, reason="Need python 3.6") |
5264 | 5231 | def test_fspath(self):
|
5265 | 5232 | with tm.ensure_clean('foo.h5') as path:
|
5266 | 5233 | with pd.HDFStore(path) as store:
|
|
0 commit comments