From 1f5ecc9a7008ea2a8af6e136a5bd6b410625623d Mon Sep 17 00:00:00 2001 From: gfyoung Date: Thu, 4 May 2017 07:01:21 -0400 Subject: [PATCH] MAINT: Remove tm.TestCase from testing (#16225) --- doc/source/contributing.rst | 4 +-- pandas/conftest.py | 7 +++++ pandas/tests/api/test_api.py | 18 +++++------ pandas/tests/api/test_types.py | 2 +- pandas/tests/computation/test_eval.py | 13 +++----- pandas/tests/dtypes/test_cast.py | 8 ++--- pandas/tests/dtypes/test_common.py | 2 +- pandas/tests/dtypes/test_concat.py | 3 +- pandas/tests/dtypes/test_generic.py | 3 +- pandas/tests/dtypes/test_inference.py | 8 ++--- pandas/tests/dtypes/test_io.py | 2 +- pandas/tests/dtypes/test_missing.py | 2 +- pandas/tests/frame/test_alter_axes.py | 4 +-- pandas/tests/frame/test_analytics.py | 2 +- pandas/tests/frame/test_api.py | 2 +- pandas/tests/frame/test_apply.py | 4 +-- pandas/tests/frame/test_asof.py | 2 +- .../tests/frame/test_axis_select_reindex.py | 2 +- pandas/tests/frame/test_block_internals.py | 2 +- pandas/tests/frame/test_combine_concat.py | 4 +-- pandas/tests/frame/test_constructors.py | 4 +-- pandas/tests/frame/test_convert_to.py | 2 +- pandas/tests/frame/test_dtypes.py | 4 +-- pandas/tests/frame/test_indexing.py | 6 ++-- pandas/tests/frame/test_missing.py | 4 +-- pandas/tests/frame/test_mutate_columns.py | 2 +- pandas/tests/frame/test_nonunique_indexes.py | 2 +- pandas/tests/frame/test_operators.py | 2 +- pandas/tests/frame/test_period.py | 2 +- pandas/tests/frame/test_quantile.py | 2 +- pandas/tests/frame/test_query_eval.py | 16 ++++------ pandas/tests/frame/test_rank.py | 2 +- pandas/tests/frame/test_replace.py | 2 +- pandas/tests/frame/test_repr_info.py | 2 +- pandas/tests/frame/test_reshape.py | 2 +- pandas/tests/frame/test_sorting.py | 4 +-- pandas/tests/frame/test_subclass.py | 2 +- pandas/tests/frame/test_timeseries.py | 2 +- pandas/tests/frame/test_to_csv.py | 2 +- pandas/tests/frame/test_validate.py | 3 +- pandas/tests/groupby/test_aggregate.py | 2 +- pandas/tests/groupby/test_bin_groupby.py | 6 ++-- pandas/tests/groupby/test_categorical.py | 2 +- pandas/tests/groupby/test_filters.py | 2 +- pandas/tests/groupby/test_groupby.py | 2 +- pandas/tests/groupby/test_nth.py | 3 +- pandas/tests/groupby/test_timegrouper.py | 2 +- pandas/tests/groupby/test_transform.py | 2 +- pandas/tests/indexes/datetimes/test_astype.py | 4 +-- .../indexes/datetimes/test_construction.py | 4 +-- .../indexes/datetimes/test_date_range.py | 8 ++--- .../tests/indexes/datetimes/test_datetime.py | 2 +- .../indexes/datetimes/test_datetimelike.py | 2 +- .../tests/indexes/datetimes/test_indexing.py | 2 +- pandas/tests/indexes/datetimes/test_misc.py | 6 ++-- .../tests/indexes/datetimes/test_missing.py | 2 +- pandas/tests/indexes/datetimes/test_ops.py | 6 ++-- .../indexes/datetimes/test_partial_slicing.py | 2 +- pandas/tests/indexes/datetimes/test_setops.py | 6 ++-- pandas/tests/indexes/datetimes/test_tools.py | 18 +++++------ pandas/tests/indexes/period/test_asfreq.py | 2 +- .../tests/indexes/period/test_construction.py | 4 +-- pandas/tests/indexes/period/test_indexing.py | 4 +-- pandas/tests/indexes/period/test_ops.py | 8 ++--- .../indexes/period/test_partial_slicing.py | 2 +- pandas/tests/indexes/period/test_period.py | 2 +- pandas/tests/indexes/period/test_setops.py | 2 +- pandas/tests/indexes/period/test_tools.py | 6 ++-- pandas/tests/indexes/test_base.py | 4 +-- pandas/tests/indexes/test_category.py | 2 +- pandas/tests/indexes/test_frozen.py | 4 +-- pandas/tests/indexes/test_interval.py | 6 ++-- pandas/tests/indexes/test_multi.py | 2 +- pandas/tests/indexes/test_numeric.py | 6 ++-- pandas/tests/indexes/test_range.py | 2 +- .../tests/indexes/timedeltas/test_astype.py | 2 +- .../indexes/timedeltas/test_construction.py | 2 +- .../tests/indexes/timedeltas/test_indexing.py | 2 +- pandas/tests/indexes/timedeltas/test_ops.py | 4 +-- .../timedeltas/test_partial_slicing.py | 2 +- .../tests/indexes/timedeltas/test_setops.py | 2 +- .../indexes/timedeltas/test_timedelta.py | 6 ++-- .../timedeltas/test_timedelta_range.py | 2 +- pandas/tests/indexes/timedeltas/test_tools.py | 2 +- pandas/tests/indexing/test_callable.py | 2 +- pandas/tests/indexing/test_categorical.py | 2 +- .../indexing/test_chaining_and_caching.py | 4 +-- pandas/tests/indexing/test_coercion.py | 10 +++--- pandas/tests/indexing/test_datetime.py | 2 +- pandas/tests/indexing/test_floats.py | 2 +- pandas/tests/indexing/test_iloc.py | 2 +- pandas/tests/indexing/test_indexing.py | 8 ++--- pandas/tests/indexing/test_indexing_slow.py | 2 +- pandas/tests/indexing/test_interval.py | 2 +- pandas/tests/indexing/test_ix.py | 2 +- pandas/tests/indexing/test_loc.py | 2 +- pandas/tests/indexing/test_multiindex.py | 6 ++-- pandas/tests/indexing/test_panel.py | 2 +- pandas/tests/indexing/test_partial.py | 2 +- pandas/tests/indexing/test_scalar.py | 2 +- pandas/tests/indexing/test_timedelta.py | 2 +- .../tests/io/formats/test_eng_formatting.py | 2 +- pandas/tests/io/formats/test_format.py | 20 ++++++------ pandas/tests/io/formats/test_printing.py | 5 ++- pandas/tests/io/formats/test_style.py | 4 +-- pandas/tests/io/formats/test_to_csv.py | 2 +- pandas/tests/io/formats/test_to_html.py | 2 +- .../tests/io/json/test_json_table_schema.py | 7 ++--- pandas/tests/io/json/test_normalize.py | 2 +- pandas/tests/io/json/test_pandas.py | 2 +- pandas/tests/io/json/test_ujson.py | 6 ++-- pandas/tests/io/msgpack/test_limits.py | 4 +-- pandas/tests/io/msgpack/test_unpack.py | 3 +- pandas/tests/io/parser/test_network.py | 2 +- pandas/tests/io/parser/test_parsers.py | 6 ++-- pandas/tests/io/parser/test_read_fwf.py | 2 +- pandas/tests/io/parser/test_textreader.py | 2 +- pandas/tests/io/parser/test_unsupported.py | 4 +-- pandas/tests/io/sas/test_sas.py | 3 +- pandas/tests/io/sas/test_sas7bdat.py | 2 +- pandas/tests/io/sas/test_xport.py | 2 +- pandas/tests/io/test_clipboard.py | 4 +-- pandas/tests/io/test_common.py | 4 +-- pandas/tests/io/test_excel.py | 28 ++++++++--------- pandas/tests/io/test_gbq.py | 3 +- pandas/tests/io/test_html.py | 9 ++---- pandas/tests/io/test_packers.py | 2 +- pandas/tests/io/test_pytables.py | 8 ++--- pandas/tests/io/test_s3.py | 4 +-- pandas/tests/io/test_sql.py | 31 ++++++++----------- pandas/tests/io/test_stata.py | 2 +- pandas/tests/plotting/common.py | 2 +- pandas/tests/plotting/test_converter.py | 4 +-- pandas/tests/reshape/test_concat.py | 2 +- pandas/tests/reshape/test_hashing.py | 2 +- pandas/tests/reshape/test_join.py | 2 +- pandas/tests/reshape/test_merge.py | 4 +-- pandas/tests/reshape/test_merge_asof.py | 2 +- pandas/tests/reshape/test_merge_ordered.py | 2 +- pandas/tests/reshape/test_pivot.py | 6 ++-- pandas/tests/reshape/test_reshape.py | 10 +++--- pandas/tests/reshape/test_tile.py | 2 +- .../tests/reshape/test_union_categoricals.py | 2 +- pandas/tests/reshape/test_util.py | 2 +- pandas/tests/scalar/test_interval.py | 2 +- pandas/tests/scalar/test_period.py | 8 ++--- pandas/tests/scalar/test_period_asfreq.py | 2 +- pandas/tests/scalar/test_timedelta.py | 2 +- pandas/tests/scalar/test_timestamp.py | 12 +++---- pandas/tests/series/test_alter_axes.py | 2 +- pandas/tests/series/test_analytics.py | 2 +- pandas/tests/series/test_api.py | 2 +- pandas/tests/series/test_apply.py | 6 ++-- pandas/tests/series/test_asof.py | 2 +- pandas/tests/series/test_combine_concat.py | 4 +-- pandas/tests/series/test_constructors.py | 2 +- pandas/tests/series/test_datetime_values.py | 2 +- pandas/tests/series/test_indexing.py | 8 ++--- pandas/tests/series/test_internals.py | 2 +- pandas/tests/series/test_io.py | 6 ++-- pandas/tests/series/test_missing.py | 4 +-- pandas/tests/series/test_operators.py | 2 +- pandas/tests/series/test_period.py | 2 +- pandas/tests/series/test_quantile.py | 2 +- pandas/tests/series/test_rank.py | 2 +- pandas/tests/series/test_replace.py | 2 +- pandas/tests/series/test_repr.py | 2 +- pandas/tests/series/test_sorting.py | 2 +- pandas/tests/series/test_subclass.py | 4 +-- pandas/tests/series/test_timeseries.py | 2 +- pandas/tests/sparse/test_arithmetics.py | 2 +- pandas/tests/sparse/test_array.py | 4 +-- pandas/tests/sparse/test_combine_concat.py | 4 +-- pandas/tests/sparse/test_format.py | 4 +-- pandas/tests/sparse/test_frame.py | 6 ++-- pandas/tests/sparse/test_groupby.py | 2 +- pandas/tests/sparse/test_indexing.py | 6 ++-- pandas/tests/sparse/test_libsparse.py | 12 +++---- pandas/tests/sparse/test_list.py | 2 +- pandas/tests/sparse/test_pivot.py | 2 +- pandas/tests/sparse/test_series.py | 8 ++--- pandas/tests/test_algos.py | 26 ++++++++-------- pandas/tests/test_base.py | 6 ++-- pandas/tests/test_categorical.py | 6 ++-- pandas/tests/test_compat.py | 3 +- pandas/tests/test_config.py | 3 +- pandas/tests/test_expressions.py | 2 +- pandas/tests/test_internals.py | 6 ++-- pandas/tests/test_join.py | 2 +- pandas/tests/test_lib.py | 6 ++-- pandas/tests/test_multilevel.py | 4 +-- pandas/tests/test_nanops.py | 10 +++--- pandas/tests/test_panel.py | 4 +-- pandas/tests/test_panel4d.py | 2 +- pandas/tests/test_panelnd.py | 2 +- pandas/tests/test_resample.py | 12 +++---- pandas/tests/test_sorting.py | 4 +-- pandas/tests/test_strings.py | 2 +- pandas/tests/test_take.py | 2 +- pandas/tests/test_testing.py | 18 +++++------ pandas/tests/test_util.py | 14 ++++----- pandas/tests/test_window.py | 10 +++--- pandas/tests/tools/test_numeric.py | 2 +- pandas/tests/tseries/test_frequencies.py | 6 ++-- pandas/tests/tseries/test_holiday.py | 10 +++--- pandas/tests/tseries/test_offsets.py | 16 +++++----- pandas/tests/tseries/test_timezones.py | 8 ++--- pandas/util/testing.py | 14 --------- 208 files changed, 446 insertions(+), 491 deletions(-) diff --git a/doc/source/contributing.rst b/doc/source/contributing.rst index 26a2f56f3c1a1..aacfe25b91564 100644 --- a/doc/source/contributing.rst +++ b/doc/source/contributing.rst @@ -617,11 +617,11 @@ the expected correct result:: Transitioning to ``pytest`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*pandas* existing test structure is *mostly* classed based, meaning that you will typically find tests wrapped in a class, inheriting from ``tm.TestCase``. +*pandas* existing test structure is *mostly* classed based, meaning that you will typically find tests wrapped in a class. .. code-block:: python - class TestReallyCoolFeature(tm.TestCase): + class TestReallyCoolFeature(object): .... Going forward, we are moving to a more *functional* style using the `pytest `__ framework, which offers a richer testing diff --git a/pandas/conftest.py b/pandas/conftest.py index caced6a0c568e..1149fae3fc0b0 100644 --- a/pandas/conftest.py +++ b/pandas/conftest.py @@ -25,6 +25,13 @@ def pytest_runtest_setup(item): pytest.skip("skipping due to --skip-network") +# Configurations for all tests and all test modules + +@pytest.fixture(autouse=True) +def configure_tests(): + pandas.set_option('chained_assignment', 'raise') + + # For running doctests: make np and pd names available @pytest.fixture(autouse=True) diff --git a/pandas/tests/api/test_api.py b/pandas/tests/api/test_api.py index 4678db4a52c5a..b1652cf6eb6db 100644 --- a/pandas/tests/api/test_api.py +++ b/pandas/tests/api/test_api.py @@ -23,7 +23,7 @@ def check(self, namespace, expected, ignored=None): tm.assert_almost_equal(result, expected) -class TestPDApi(Base, tm.TestCase): +class TestPDApi(Base): # these are optionally imported based on testing # & need to be ignored @@ -117,7 +117,7 @@ def test_api(self): self.ignored) -class TestApi(Base, tm.TestCase): +class TestApi(Base): allowed = ['types'] @@ -137,7 +137,7 @@ def test_testing(self): self.check(testing, self.funcs) -class TestDatetoolsDeprecation(tm.TestCase): +class TestDatetoolsDeprecation(object): def test_deprecation_access_func(self): with tm.assert_produces_warning(FutureWarning, @@ -150,7 +150,7 @@ def test_deprecation_access_obj(self): pd.datetools.monthEnd -class TestTopLevelDeprecations(tm.TestCase): +class TestTopLevelDeprecations(object): # top-level API deprecations # GH 13790 @@ -191,35 +191,35 @@ def test_get_store(self): s.close() -class TestJson(tm.TestCase): +class TestJson(object): def test_deprecation_access_func(self): with catch_warnings(record=True): pd.json.dumps([]) -class TestParser(tm.TestCase): +class TestParser(object): def test_deprecation_access_func(self): with catch_warnings(record=True): pd.parser.na_values -class TestLib(tm.TestCase): +class TestLib(object): def test_deprecation_access_func(self): with catch_warnings(record=True): pd.lib.infer_dtype('foo') -class TestTSLib(tm.TestCase): +class TestTSLib(object): def test_deprecation_access_func(self): with catch_warnings(record=True): pd.tslib.Timestamp('20160101') -class TestTypes(tm.TestCase): +class TestTypes(object): def test_deprecation_access_func(self): with tm.assert_produces_warning( diff --git a/pandas/tests/api/test_types.py b/pandas/tests/api/test_types.py index 834857b87960c..1cbcf3f9109a4 100644 --- a/pandas/tests/api/test_types.py +++ b/pandas/tests/api/test_types.py @@ -13,7 +13,7 @@ from .test_api import Base -class TestTypes(Base, tm.TestCase): +class TestTypes(Base): allowed = ['is_bool', 'is_bool_dtype', 'is_categorical', 'is_categorical_dtype', 'is_complex', diff --git a/pandas/tests/computation/test_eval.py b/pandas/tests/computation/test_eval.py index 5086b803419c6..89ab4531877a4 100644 --- a/pandas/tests/computation/test_eval.py +++ b/pandas/tests/computation/test_eval.py @@ -95,11 +95,10 @@ def _is_py3_complex_incompat(result, expected): _good_arith_ops = com.difference(_arith_ops_syms, _special_case_arith_ops_syms) -class TestEvalNumexprPandas(tm.TestCase): +class TestEvalNumexprPandas(object): @classmethod def setup_class(cls): - super(TestEvalNumexprPandas, cls).setup_class() tm.skip_if_no_ne() import numexpr as ne cls.ne = ne @@ -108,7 +107,6 @@ def setup_class(cls): @classmethod def teardown_class(cls): - super(TestEvalNumexprPandas, cls).teardown_class() del cls.engine, cls.parser if hasattr(cls, 'ne'): del cls.ne @@ -1067,11 +1065,10 @@ def test_performance_warning_for_poor_alignment(self, engine, parser): # ------------------------------------ # Slightly more complex ops -class TestOperationsNumExprPandas(tm.TestCase): +class TestOperationsNumExprPandas(object): @classmethod def setup_class(cls): - super(TestOperationsNumExprPandas, cls).setup_class() tm.skip_if_no_ne() cls.engine = 'numexpr' cls.parser = 'pandas' @@ -1079,7 +1076,6 @@ def setup_class(cls): @classmethod def teardown_class(cls): - super(TestOperationsNumExprPandas, cls).teardown_class() del cls.engine, cls.parser def eval(self, *args, **kwargs): @@ -1584,11 +1580,10 @@ def setup_class(cls): cls.arith_ops = expr._arith_ops_syms + expr._cmp_ops_syms -class TestMathPythonPython(tm.TestCase): +class TestMathPythonPython(object): @classmethod def setup_class(cls): - super(TestMathPythonPython, cls).setup_class() tm.skip_if_no_ne() cls.engine = 'python' cls.parser = 'pandas' @@ -1873,7 +1868,7 @@ def test_negate_lt_eq_le(engine, parser): tm.assert_frame_equal(result, expected) -class TestValidate(tm.TestCase): +class TestValidate(object): def test_validate_bool_args(self): invalid_values = [1, "True", [1, 2, 3], 5.0] diff --git a/pandas/tests/dtypes/test_cast.py b/pandas/tests/dtypes/test_cast.py index cbf049b95b6ef..e92724a5d9cd4 100644 --- a/pandas/tests/dtypes/test_cast.py +++ b/pandas/tests/dtypes/test_cast.py @@ -26,7 +26,7 @@ from pandas.util import testing as tm -class TestMaybeDowncast(tm.TestCase): +class TestMaybeDowncast(object): def test_downcast_conv(self): # test downcasting @@ -156,7 +156,7 @@ def test_infer_dtype_from_array(self, arr, expected): assert dtype == expected -class TestMaybe(tm.TestCase): +class TestMaybe(object): def test_maybe_convert_string_to_array(self): result = maybe_convert_string_to_object('x') @@ -214,7 +214,7 @@ def test_maybe_convert_scalar(self): assert result == Timedelta('1 day 1 min').value -class TestConvert(tm.TestCase): +class TestConvert(object): def test_maybe_convert_objects_copy(self): values = np.array([1, 2]) @@ -233,7 +233,7 @@ def test_maybe_convert_objects_copy(self): assert values is not out -class TestCommonTypes(tm.TestCase): +class TestCommonTypes(object): def test_numpy_dtypes(self): # (source_types, destination_type) diff --git a/pandas/tests/dtypes/test_common.py b/pandas/tests/dtypes/test_common.py index 0472f0599cd9b..68518e235d417 100644 --- a/pandas/tests/dtypes/test_common.py +++ b/pandas/tests/dtypes/test_common.py @@ -12,7 +12,7 @@ import pandas.util.testing as tm -class TestPandasDtype(tm.TestCase): +class TestPandasDtype(object): # Passing invalid dtype, both as a string or object, must raise TypeError # Per issue GH15520 diff --git a/pandas/tests/dtypes/test_concat.py b/pandas/tests/dtypes/test_concat.py index c0be0dc38d27f..ca579e2dc9390 100644 --- a/pandas/tests/dtypes/test_concat.py +++ b/pandas/tests/dtypes/test_concat.py @@ -2,10 +2,9 @@ import pandas as pd import pandas.core.dtypes.concat as _concat -import pandas.util.testing as tm -class TestConcatCompat(tm.TestCase): +class TestConcatCompat(object): def check_concat(self, to_concat, exp): for klass in [pd.Index, pd.Series]: diff --git a/pandas/tests/dtypes/test_generic.py b/pandas/tests/dtypes/test_generic.py index e9af53aaa1e1a..653d7d3082c08 100644 --- a/pandas/tests/dtypes/test_generic.py +++ b/pandas/tests/dtypes/test_generic.py @@ -3,11 +3,10 @@ from warnings import catch_warnings import numpy as np import pandas as pd -import pandas.util.testing as tm from pandas.core.dtypes import generic as gt -class TestABCClasses(tm.TestCase): +class TestABCClasses(object): tuples = [[1, 2, 2], ['red', 'blue', 'red']] multi_index = pd.MultiIndex.from_arrays(tuples, names=('number', 'color')) datetime_index = pd.to_datetime(['2000/1/1', '2010/1/1']) diff --git a/pandas/tests/dtypes/test_inference.py b/pandas/tests/dtypes/test_inference.py index ec02a5a200308..3790ebe0d3e7c 100644 --- a/pandas/tests/dtypes/test_inference.py +++ b/pandas/tests/dtypes/test_inference.py @@ -226,7 +226,7 @@ def test_is_recompilable(): assert not inference.is_re_compilable(f) -class TestInference(tm.TestCase): +class TestInference(object): def test_infer_dtype_bytes(self): compare = 'string' if PY2 else 'bytes' @@ -405,7 +405,7 @@ def test_mixed_dtypes_remain_object_array(self): tm.assert_numpy_array_equal(result, array) -class TestTypeInference(tm.TestCase): +class TestTypeInference(object): def test_length_zero(self): result = lib.infer_dtype(np.array([], dtype='i4')) @@ -774,7 +774,7 @@ def test_categorical(self): assert result == 'categorical' -class TestNumberScalar(tm.TestCase): +class TestNumberScalar(object): def test_is_number(self): @@ -917,7 +917,7 @@ def test_is_timedelta(self): assert not is_timedelta64_ns_dtype(tdi.astype('timedelta64[h]')) -class Testisscalar(tm.TestCase): +class Testisscalar(object): def test_isscalar_builtin_scalars(self): assert is_scalar(None) diff --git a/pandas/tests/dtypes/test_io.py b/pandas/tests/dtypes/test_io.py index 443c0c5410e61..58a1c3540cd03 100644 --- a/pandas/tests/dtypes/test_io.py +++ b/pandas/tests/dtypes/test_io.py @@ -7,7 +7,7 @@ from pandas.compat import long, u -class TestParseSQL(tm.TestCase): +class TestParseSQL(object): def test_convert_sql_column_floats(self): arr = np.array([1.5, None, 3, 4.2], dtype=object) diff --git a/pandas/tests/dtypes/test_missing.py b/pandas/tests/dtypes/test_missing.py index 78396a8d89d91..90993890b7553 100644 --- a/pandas/tests/dtypes/test_missing.py +++ b/pandas/tests/dtypes/test_missing.py @@ -45,7 +45,7 @@ def test_notnull(): assert (isinstance(isnull(s), Series)) -class TestIsNull(tm.TestCase): +class TestIsNull(object): def test_0d_array(self): assert isnull(np.array(np.nan)) diff --git a/pandas/tests/frame/test_alter_axes.py b/pandas/tests/frame/test_alter_axes.py index 34ab0b72f9b9a..e6313dfc602a8 100644 --- a/pandas/tests/frame/test_alter_axes.py +++ b/pandas/tests/frame/test_alter_axes.py @@ -25,7 +25,7 @@ from pandas.tests.frame.common import TestData -class TestDataFrameAlterAxes(tm.TestCase, TestData): +class TestDataFrameAlterAxes(TestData): def test_set_index(self): idx = Index(np.arange(len(self.mixed_frame))) @@ -806,7 +806,7 @@ def test_set_index_preserve_categorical_dtype(self): tm.assert_frame_equal(result, df) -class TestIntervalIndex(tm.TestCase): +class TestIntervalIndex(object): def test_setitem(self): diff --git a/pandas/tests/frame/test_analytics.py b/pandas/tests/frame/test_analytics.py index 89ee096b4434e..be89b27912d1c 100644 --- a/pandas/tests/frame/test_analytics.py +++ b/pandas/tests/frame/test_analytics.py @@ -24,7 +24,7 @@ from pandas.tests.frame.common import TestData -class TestDataFrameAnalytics(tm.TestCase, TestData): +class TestDataFrameAnalytics(TestData): # ---------------------------------------------------------------------= # Correlation and covariance diff --git a/pandas/tests/frame/test_api.py b/pandas/tests/frame/test_api.py index 208c7b5ace50e..f63918c97c614 100644 --- a/pandas/tests/frame/test_api.py +++ b/pandas/tests/frame/test_api.py @@ -69,7 +69,7 @@ def test_add_prefix_suffix(self): tm.assert_index_equal(with_suffix.columns, expected) -class TestDataFrameMisc(tm.TestCase, SharedWithSparse, TestData): +class TestDataFrameMisc(SharedWithSparse, TestData): klass = DataFrame diff --git a/pandas/tests/frame/test_apply.py b/pandas/tests/frame/test_apply.py index 5febe8c62abe8..aa7c7a7120c1b 100644 --- a/pandas/tests/frame/test_apply.py +++ b/pandas/tests/frame/test_apply.py @@ -19,7 +19,7 @@ from pandas.tests.frame.common import TestData -class TestDataFrameApply(tm.TestCase, TestData): +class TestDataFrameApply(TestData): def test_apply(self): with np.errstate(all='ignore'): @@ -482,7 +482,7 @@ def zip_frames(*frames): return pd.concat(zipped, axis=1) -class TestDataFrameAggregate(tm.TestCase, TestData): +class TestDataFrameAggregate(TestData): _multiprocess_can_split_ = True diff --git a/pandas/tests/frame/test_asof.py b/pandas/tests/frame/test_asof.py index 4207238f0cd4f..d4e3d541937dc 100644 --- a/pandas/tests/frame/test_asof.py +++ b/pandas/tests/frame/test_asof.py @@ -9,7 +9,7 @@ from .common import TestData -class TestFrameAsof(TestData, tm.TestCase): +class TestFrameAsof(TestData): def setup_method(self, method): self.N = N = 50 self.rng = date_range('1/1/1990', periods=N, freq='53s') diff --git a/pandas/tests/frame/test_axis_select_reindex.py b/pandas/tests/frame/test_axis_select_reindex.py index a563b678a3786..a6326083c1bee 100644 --- a/pandas/tests/frame/test_axis_select_reindex.py +++ b/pandas/tests/frame/test_axis_select_reindex.py @@ -22,7 +22,7 @@ from pandas.tests.frame.common import TestData -class TestDataFrameSelectReindex(tm.TestCase, TestData): +class TestDataFrameSelectReindex(TestData): # These are specific reindex-based tests; other indexing tests should go in # test_indexing diff --git a/pandas/tests/frame/test_block_internals.py b/pandas/tests/frame/test_block_internals.py index 44dc6df756f3d..c1a5b437be5d0 100644 --- a/pandas/tests/frame/test_block_internals.py +++ b/pandas/tests/frame/test_block_internals.py @@ -28,7 +28,7 @@ # structure -class TestDataFrameBlockInternals(tm.TestCase, TestData): +class TestDataFrameBlockInternals(TestData): def test_cast_internals(self): casted = DataFrame(self.frame._data, dtype=int) diff --git a/pandas/tests/frame/test_combine_concat.py b/pandas/tests/frame/test_combine_concat.py index 44f17faabe20d..688cacdee263e 100644 --- a/pandas/tests/frame/test_combine_concat.py +++ b/pandas/tests/frame/test_combine_concat.py @@ -18,7 +18,7 @@ from pandas.util.testing import assert_frame_equal, assert_series_equal -class TestDataFrameConcatCommon(tm.TestCase, TestData): +class TestDataFrameConcatCommon(TestData): def test_concat_multiple_frames_dtypes(self): @@ -441,7 +441,7 @@ def test_concat_numerical_names(self): tm.assert_frame_equal(result, expected) -class TestDataFrameCombineFirst(tm.TestCase, TestData): +class TestDataFrameCombineFirst(TestData): def test_combine_first_mixed(self): a = Series(['a', 'b'], index=lrange(2)) diff --git a/pandas/tests/frame/test_constructors.py b/pandas/tests/frame/test_constructors.py index 5b00ddc51da46..8459900ea1059 100644 --- a/pandas/tests/frame/test_constructors.py +++ b/pandas/tests/frame/test_constructors.py @@ -32,7 +32,7 @@ 'int32', 'int64'] -class TestDataFrameConstructors(tm.TestCase, TestData): +class TestDataFrameConstructors(TestData): def test_constructor(self): df = DataFrame() @@ -1903,7 +1903,7 @@ def test_to_frame_with_falsey_names(self): tm.assert_series_equal(result, expected) -class TestDataFrameConstructorWithDatetimeTZ(tm.TestCase, TestData): +class TestDataFrameConstructorWithDatetimeTZ(TestData): def test_from_dict(self): diff --git a/pandas/tests/frame/test_convert_to.py b/pandas/tests/frame/test_convert_to.py index 353b4b873332e..e0cdca7904db7 100644 --- a/pandas/tests/frame/test_convert_to.py +++ b/pandas/tests/frame/test_convert_to.py @@ -11,7 +11,7 @@ from pandas.tests.frame.common import TestData -class TestDataFrameConvertTo(tm.TestCase, TestData): +class TestDataFrameConvertTo(TestData): def test_to_dict(self): test_data = { diff --git a/pandas/tests/frame/test_dtypes.py b/pandas/tests/frame/test_dtypes.py index 2d39db16dbd8d..b99a6fabfa42b 100644 --- a/pandas/tests/frame/test_dtypes.py +++ b/pandas/tests/frame/test_dtypes.py @@ -19,7 +19,7 @@ import pandas as pd -class TestDataFrameDataTypes(tm.TestCase, TestData): +class TestDataFrameDataTypes(TestData): def test_concat_empty_dataframe_dtypes(self): df = DataFrame(columns=list("abc")) @@ -542,7 +542,7 @@ def test_arg_for_errors_in_astype(self): df.astype(np.int8, errors='ignore') -class TestDataFrameDatetimeWithTZ(tm.TestCase, TestData): +class TestDataFrameDatetimeWithTZ(TestData): def test_interleave(self): diff --git a/pandas/tests/frame/test_indexing.py b/pandas/tests/frame/test_indexing.py index 42eb7148d616e..f0503b60eeefa 100644 --- a/pandas/tests/frame/test_indexing.py +++ b/pandas/tests/frame/test_indexing.py @@ -36,7 +36,7 @@ from pandas.tests.frame.common import TestData -class TestDataFrameIndexing(tm.TestCase, TestData): +class TestDataFrameIndexing(TestData): def test_getitem(self): # Slicing @@ -2912,7 +2912,7 @@ def test_type_error_multiindex(self): assert_series_equal(result, expected) -class TestDataFrameIndexingDatetimeWithTZ(tm.TestCase, TestData): +class TestDataFrameIndexingDatetimeWithTZ(TestData): def setup_method(self, method): self.idx = Index(date_range('20130101', periods=3, tz='US/Eastern'), @@ -2970,7 +2970,7 @@ def test_transpose(self): assert_frame_equal(result, expected) -class TestDataFrameIndexingUInt64(tm.TestCase, TestData): +class TestDataFrameIndexingUInt64(TestData): def setup_method(self, method): self.ir = Index(np.arange(3), dtype=np.uint64) diff --git a/pandas/tests/frame/test_missing.py b/pandas/tests/frame/test_missing.py index ffba141ddc15d..77f0357685cab 100644 --- a/pandas/tests/frame/test_missing.py +++ b/pandas/tests/frame/test_missing.py @@ -34,7 +34,7 @@ def _skip_if_no_pchip(): pytest.skip('scipy.interpolate.pchip missing') -class TestDataFrameMissingData(tm.TestCase, TestData): +class TestDataFrameMissingData(TestData): def test_dropEmptyRows(self): N = len(self.frame.index) @@ -519,7 +519,7 @@ def test_fill_value_when_combine_const(self): assert_frame_equal(res, exp) -class TestDataFrameInterpolate(tm.TestCase, TestData): +class TestDataFrameInterpolate(TestData): def test_interp_basic(self): df = DataFrame({'A': [1, 2, np.nan, 4], diff --git a/pandas/tests/frame/test_mutate_columns.py b/pandas/tests/frame/test_mutate_columns.py index ac76970aaa901..4462260a290d9 100644 --- a/pandas/tests/frame/test_mutate_columns.py +++ b/pandas/tests/frame/test_mutate_columns.py @@ -17,7 +17,7 @@ # Column add, remove, delete. -class TestDataFrameMutateColumns(tm.TestCase, TestData): +class TestDataFrameMutateColumns(TestData): def test_assign(self): df = DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]}) diff --git a/pandas/tests/frame/test_nonunique_indexes.py b/pandas/tests/frame/test_nonunique_indexes.py index 4bc0176b570e3..4f77ba0ae1f5a 100644 --- a/pandas/tests/frame/test_nonunique_indexes.py +++ b/pandas/tests/frame/test_nonunique_indexes.py @@ -16,7 +16,7 @@ from pandas.tests.frame.common import TestData -class TestDataFrameNonuniqueIndexes(tm.TestCase, TestData): +class TestDataFrameNonuniqueIndexes(TestData): def test_column_dups_operations(self): diff --git a/pandas/tests/frame/test_operators.py b/pandas/tests/frame/test_operators.py index 9083b7952909e..8ec6c6e6263d8 100644 --- a/pandas/tests/frame/test_operators.py +++ b/pandas/tests/frame/test_operators.py @@ -28,7 +28,7 @@ _check_mixed_int) -class TestDataFrameOperators(tm.TestCase, TestData): +class TestDataFrameOperators(TestData): def test_operators(self): garbage = random.random(4) diff --git a/pandas/tests/frame/test_period.py b/pandas/tests/frame/test_period.py index 49de3b8e8cd9b..482210966fe6b 100644 --- a/pandas/tests/frame/test_period.py +++ b/pandas/tests/frame/test_period.py @@ -12,7 +12,7 @@ def _permute(obj): return obj.take(np.random.permutation(len(obj))) -class TestPeriodIndex(tm.TestCase): +class TestPeriodIndex(object): def setup_method(self, method): pass diff --git a/pandas/tests/frame/test_quantile.py b/pandas/tests/frame/test_quantile.py index 33f72cde1b9a3..2482e493dbefd 100644 --- a/pandas/tests/frame/test_quantile.py +++ b/pandas/tests/frame/test_quantile.py @@ -17,7 +17,7 @@ from pandas.tests.frame.common import TestData -class TestDataFrameQuantile(tm.TestCase, TestData): +class TestDataFrameQuantile(TestData): def test_quantile(self): from numpy import percentile diff --git a/pandas/tests/frame/test_query_eval.py b/pandas/tests/frame/test_query_eval.py index 6a06e3f4872ce..f0f1a2df27e93 100644 --- a/pandas/tests/frame/test_query_eval.py +++ b/pandas/tests/frame/test_query_eval.py @@ -48,7 +48,7 @@ def skip_if_no_ne(engine='numexpr'): "installed") -class TestCompat(tm.TestCase): +class TestCompat(object): def setup_method(self, method): self.df = DataFrame({'A': [1, 2, 3]}) @@ -96,7 +96,7 @@ def test_query_numexpr(self): lambda: df.eval('A+1', engine='numexpr')) -class TestDataFrameEval(tm.TestCase, TestData): +class TestDataFrameEval(TestData): def test_ops(self): @@ -172,7 +172,7 @@ def test_eval_resolvers_as_list(self): dict1['a'] + dict2['b']) -class TestDataFrameQueryWithMultiIndex(tm.TestCase): +class TestDataFrameQueryWithMultiIndex(object): def test_query_with_named_multiindex(self, parser, engine): tm.skip_if_no_ne(engine) @@ -384,18 +384,16 @@ def test_raise_on_panel4d_with_multiindex(self, parser, engine): pd.eval('p4d + 1', parser=parser, engine=engine) -class TestDataFrameQueryNumExprPandas(tm.TestCase): +class TestDataFrameQueryNumExprPandas(object): @classmethod def setup_class(cls): - super(TestDataFrameQueryNumExprPandas, cls).setup_class() cls.engine = 'numexpr' cls.parser = 'pandas' tm.skip_if_no_ne(cls.engine) @classmethod def teardown_class(cls): - super(TestDataFrameQueryNumExprPandas, cls).teardown_class() del cls.engine, cls.parser def test_date_query_with_attribute_access(self): @@ -858,7 +856,7 @@ def test_query_builtin(self): assert_frame_equal(expected, result) -class TestDataFrameQueryStrings(tm.TestCase): +class TestDataFrameQueryStrings(object): def test_str_query_method(self, parser, engine): tm.skip_if_no_ne(engine) @@ -1039,11 +1037,10 @@ def test_query_string_scalar_variable(self, parser, engine): assert_frame_equal(e, r) -class TestDataFrameEvalNumExprPandas(tm.TestCase): +class TestDataFrameEvalNumExprPandas(object): @classmethod def setup_class(cls): - super(TestDataFrameEvalNumExprPandas, cls).setup_class() cls.engine = 'numexpr' cls.parser = 'pandas' tm.skip_if_no_ne() @@ -1099,5 +1096,4 @@ class TestDataFrameEvalPythonPython(TestDataFrameEvalNumExprPython): @classmethod def setup_class(cls): - super(TestDataFrameEvalPythonPython, cls).teardown_class() cls.engine = cls.parser = 'python' diff --git a/pandas/tests/frame/test_rank.py b/pandas/tests/frame/test_rank.py index b115218d76958..acf887d047c9e 100644 --- a/pandas/tests/frame/test_rank.py +++ b/pandas/tests/frame/test_rank.py @@ -12,7 +12,7 @@ from pandas.tests.frame.common import TestData -class TestRank(tm.TestCase, TestData): +class TestRank(TestData): s = Series([1, 3, 4, 2, nan, 2, 1, 5, nan, 3]) df = DataFrame({'A': s, 'B': s}) diff --git a/pandas/tests/frame/test_replace.py b/pandas/tests/frame/test_replace.py index 3f160012cb446..fbc4accd0e41e 100644 --- a/pandas/tests/frame/test_replace.py +++ b/pandas/tests/frame/test_replace.py @@ -23,7 +23,7 @@ from pandas.tests.frame.common import TestData -class TestDataFrameReplace(tm.TestCase, TestData): +class TestDataFrameReplace(TestData): def test_replace_inplace(self): self.tsframe['A'][:5] = nan diff --git a/pandas/tests/frame/test_repr_info.py b/pandas/tests/frame/test_repr_info.py index 0300c53e086cd..cc37f8cc3cb02 100644 --- a/pandas/tests/frame/test_repr_info.py +++ b/pandas/tests/frame/test_repr_info.py @@ -23,7 +23,7 @@ # structure -class TestDataFrameReprInfoEtc(tm.TestCase, TestData): +class TestDataFrameReprInfoEtc(TestData): def test_repr_empty(self): # empty diff --git a/pandas/tests/frame/test_reshape.py b/pandas/tests/frame/test_reshape.py index 79ee76ee362c3..fdb0119d8ae60 100644 --- a/pandas/tests/frame/test_reshape.py +++ b/pandas/tests/frame/test_reshape.py @@ -24,7 +24,7 @@ from pandas.tests.frame.common import TestData -class TestDataFrameReshape(tm.TestCase, TestData): +class TestDataFrameReshape(TestData): def test_pivot(self): data = { diff --git a/pandas/tests/frame/test_sorting.py b/pandas/tests/frame/test_sorting.py index 457ea32ec56f7..98f7f82c0ace7 100644 --- a/pandas/tests/frame/test_sorting.py +++ b/pandas/tests/frame/test_sorting.py @@ -18,7 +18,7 @@ from pandas.tests.frame.common import TestData -class TestDataFrameSorting(tm.TestCase, TestData): +class TestDataFrameSorting(TestData): def test_sort(self): frame = DataFrame(np.arange(16).reshape(4, 4), index=[1, 2, 3, 4], @@ -315,7 +315,7 @@ def test_sort_nat_values_in_int_column(self): assert_frame_equal(df_sorted, df_reversed) -class TestDataFrameSortIndexKinds(tm.TestCase, TestData): +class TestDataFrameSortIndexKinds(TestData): def test_sort_index_multicolumn(self): A = np.arange(5).repeat(20) diff --git a/pandas/tests/frame/test_subclass.py b/pandas/tests/frame/test_subclass.py index 40a8ece852623..52c591e4dcbb0 100644 --- a/pandas/tests/frame/test_subclass.py +++ b/pandas/tests/frame/test_subclass.py @@ -12,7 +12,7 @@ from pandas.tests.frame.common import TestData -class TestDataFrameSubclassing(tm.TestCase, TestData): +class TestDataFrameSubclassing(TestData): def test_frame_subclassing_and_slicing(self): # Subclass frame and ensure it returns the right class on slicing it diff --git a/pandas/tests/frame/test_timeseries.py b/pandas/tests/frame/test_timeseries.py index f52f4697b1b08..143a7ea8f6fb2 100644 --- a/pandas/tests/frame/test_timeseries.py +++ b/pandas/tests/frame/test_timeseries.py @@ -24,7 +24,7 @@ from pandas.tests.frame.common import TestData -class TestDataFrameTimeSeriesMethods(tm.TestCase, TestData): +class TestDataFrameTimeSeriesMethods(TestData): def test_diff(self): the_diff = self.tsframe.diff(1) diff --git a/pandas/tests/frame/test_to_csv.py b/pandas/tests/frame/test_to_csv.py index 3e38f2a71d99d..69bd2b008416f 100644 --- a/pandas/tests/frame/test_to_csv.py +++ b/pandas/tests/frame/test_to_csv.py @@ -29,7 +29,7 @@ 'int32', 'int64'] -class TestDataFrameToCSV(tm.TestCase, TestData): +class TestDataFrameToCSV(TestData): def test_to_csv_from_csv1(self): diff --git a/pandas/tests/frame/test_validate.py b/pandas/tests/frame/test_validate.py index 343853b3fcfa0..d6065e6042908 100644 --- a/pandas/tests/frame/test_validate.py +++ b/pandas/tests/frame/test_validate.py @@ -1,10 +1,9 @@ from pandas.core.frame import DataFrame -import pandas.util.testing as tm import pytest -class TestDataFrameValidate(tm.TestCase): +class TestDataFrameValidate(object): """Tests for error handling related to data types of method arguments.""" df = DataFrame({'a': [1, 2], 'b': [3, 4]}) diff --git a/pandas/tests/groupby/test_aggregate.py b/pandas/tests/groupby/test_aggregate.py index 769e4d14d354b..d7b46e6748b99 100644 --- a/pandas/tests/groupby/test_aggregate.py +++ b/pandas/tests/groupby/test_aggregate.py @@ -25,7 +25,7 @@ import pandas.util.testing as tm -class TestGroupByAggregate(tm.TestCase): +class TestGroupByAggregate(object): def setup_method(self, method): self.ts = tm.makeTimeSeries() diff --git a/pandas/tests/groupby/test_bin_groupby.py b/pandas/tests/groupby/test_bin_groupby.py index bdac535b3d2e2..f527c732fb76b 100644 --- a/pandas/tests/groupby/test_bin_groupby.py +++ b/pandas/tests/groupby/test_bin_groupby.py @@ -46,7 +46,7 @@ def test_series_bin_grouper(): assert_almost_equal(counts, exp_counts) -class TestBinGroupers(tm.TestCase): +class TestBinGroupers(object): def setup_method(self, method): self.obj = np.random.randn(10, 1) @@ -117,11 +117,11 @@ def _ohlc(group): _check('float64') -class TestMoments(tm.TestCase): +class TestMoments(object): pass -class TestReducer(tm.TestCase): +class TestReducer(object): def test_int_index(self): from pandas.core.series import Series diff --git a/pandas/tests/groupby/test_categorical.py b/pandas/tests/groupby/test_categorical.py index 9d2134927389d..fdc03acd3e931 100644 --- a/pandas/tests/groupby/test_categorical.py +++ b/pandas/tests/groupby/test_categorical.py @@ -15,7 +15,7 @@ from .common import MixIn -class TestGroupByCategorical(MixIn, tm.TestCase): +class TestGroupByCategorical(MixIn): def test_level_groupby_get_group(self): # GH15155 diff --git a/pandas/tests/groupby/test_filters.py b/pandas/tests/groupby/test_filters.py index b05b938fd8205..cac6b46af8f87 100644 --- a/pandas/tests/groupby/test_filters.py +++ b/pandas/tests/groupby/test_filters.py @@ -23,7 +23,7 @@ import pandas as pd -class TestGroupByFilter(tm.TestCase): +class TestGroupByFilter(object): def setup_method(self, method): self.ts = tm.makeTimeSeries() diff --git a/pandas/tests/groupby/test_groupby.py b/pandas/tests/groupby/test_groupby.py index 8d86d40c379bf..88afa51e46b6c 100644 --- a/pandas/tests/groupby/test_groupby.py +++ b/pandas/tests/groupby/test_groupby.py @@ -28,7 +28,7 @@ from .common import MixIn -class TestGroupBy(MixIn, tm.TestCase): +class TestGroupBy(MixIn): def test_basic(self): def checkit(dtype): diff --git a/pandas/tests/groupby/test_nth.py b/pandas/tests/groupby/test_nth.py index 0b6aeaf155f86..7912b4bf3bdf6 100644 --- a/pandas/tests/groupby/test_nth.py +++ b/pandas/tests/groupby/test_nth.py @@ -2,13 +2,12 @@ import pandas as pd from pandas import DataFrame, MultiIndex, Index, Series, isnull from pandas.compat import lrange -from pandas.util import testing as tm from pandas.util.testing import assert_frame_equal, assert_series_equal from .common import MixIn -class TestNth(MixIn, tm.TestCase): +class TestNth(MixIn): def test_first_last_nth(self): # tests for first / last / nth diff --git a/pandas/tests/groupby/test_timegrouper.py b/pandas/tests/groupby/test_timegrouper.py index 42caecbdb700e..2196318d1920e 100644 --- a/pandas/tests/groupby/test_timegrouper.py +++ b/pandas/tests/groupby/test_timegrouper.py @@ -14,7 +14,7 @@ from pandas.util.testing import assert_frame_equal, assert_series_equal -class TestGroupBy(tm.TestCase): +class TestGroupBy(object): def test_groupby_with_timegrouper(self): # GH 4161 diff --git a/pandas/tests/groupby/test_transform.py b/pandas/tests/groupby/test_transform.py index 0b81235ef2117..40434ff510421 100644 --- a/pandas/tests/groupby/test_transform.py +++ b/pandas/tests/groupby/test_transform.py @@ -17,7 +17,7 @@ from pandas.core.config import option_context -class TestGroupBy(MixIn, tm.TestCase): +class TestGroupBy(MixIn): def test_transform(self): data = Series(np.arange(9) // 3, index=np.arange(9)) diff --git a/pandas/tests/indexes/datetimes/test_astype.py b/pandas/tests/indexes/datetimes/test_astype.py index 185787d75f6e1..0f7acf1febae8 100644 --- a/pandas/tests/indexes/datetimes/test_astype.py +++ b/pandas/tests/indexes/datetimes/test_astype.py @@ -9,7 +9,7 @@ Int64Index, Period) -class TestDatetimeIndex(tm.TestCase): +class TestDatetimeIndex(object): def test_astype(self): # GH 13149, GH 13209 @@ -185,7 +185,7 @@ def _check_rng(rng): _check_rng(rng_utc) -class TestToPeriod(tm.TestCase): +class TestToPeriod(object): def setup_method(self, method): data = [Timestamp('2007-01-01 10:11:12.123456Z'), diff --git a/pandas/tests/indexes/datetimes/test_construction.py b/pandas/tests/indexes/datetimes/test_construction.py index 9af4136afd025..fcfc56ea823da 100644 --- a/pandas/tests/indexes/datetimes/test_construction.py +++ b/pandas/tests/indexes/datetimes/test_construction.py @@ -12,7 +12,7 @@ to_datetime) -class TestDatetimeIndex(tm.TestCase): +class TestDatetimeIndex(object): def test_construction_caching(self): @@ -446,7 +446,7 @@ def test_000constructor_resolution(self): assert idx.nanosecond[0] == t1.nanosecond -class TestTimeSeries(tm.TestCase): +class TestTimeSeries(object): def test_dti_constructor_preserve_dti_freq(self): rng = date_range('1/1/2000', '1/2/2000', freq='5min') diff --git a/pandas/tests/indexes/datetimes/test_date_range.py b/pandas/tests/indexes/datetimes/test_date_range.py index 67d6b0f314ecb..0586ea9c4db2b 100644 --- a/pandas/tests/indexes/datetimes/test_date_range.py +++ b/pandas/tests/indexes/datetimes/test_date_range.py @@ -26,7 +26,7 @@ def eq_gen_range(kwargs, expected): assert (np.array_equal(list(rng), expected)) -class TestDateRanges(TestData, tm.TestCase): +class TestDateRanges(TestData): def test_date_range_gen_error(self): rng = date_range('1/1/2000 00:00', '1/1/2000 00:18', freq='5min') @@ -147,7 +147,7 @@ def test_catch_infinite_loop(self): datetime(2011, 11, 12), freq=offset) -class TestGenRangeGeneration(tm.TestCase): +class TestGenRangeGeneration(object): def test_generate(self): rng1 = list(generate_range(START, END, offset=BDay())) @@ -196,7 +196,7 @@ def test_precision_finer_than_offset(self): tm.assert_index_equal(result2, expected2) -class TestBusinessDateRange(tm.TestCase): +class TestBusinessDateRange(object): def setup_method(self, method): self.rng = bdate_range(START, END) @@ -482,7 +482,7 @@ def test_freq_divides_end_in_nanos(self): tm.assert_index_equal(result_2, expected_2) -class TestCustomDateRange(tm.TestCase): +class TestCustomDateRange(object): def setup_method(self, method): self.rng = cdate_range(START, END) diff --git a/pandas/tests/indexes/datetimes/test_datetime.py b/pandas/tests/indexes/datetimes/test_datetime.py index 7b22d1615fbeb..96c8da546ff9d 100644 --- a/pandas/tests/indexes/datetimes/test_datetime.py +++ b/pandas/tests/indexes/datetimes/test_datetime.py @@ -15,7 +15,7 @@ randn = np.random.randn -class TestDatetimeIndex(tm.TestCase): +class TestDatetimeIndex(object): def test_get_loc(self): idx = pd.date_range('2000-01-01', periods=3) diff --git a/pandas/tests/indexes/datetimes/test_datetimelike.py b/pandas/tests/indexes/datetimes/test_datetimelike.py index 2e184b1aa4e51..3b970ee382521 100644 --- a/pandas/tests/indexes/datetimes/test_datetimelike.py +++ b/pandas/tests/indexes/datetimes/test_datetimelike.py @@ -8,7 +8,7 @@ from ..datetimelike import DatetimeLike -class TestDatetimeIndex(DatetimeLike, tm.TestCase): +class TestDatetimeIndex(DatetimeLike): _holder = DatetimeIndex def setup_method(self, method): diff --git a/pandas/tests/indexes/datetimes/test_indexing.py b/pandas/tests/indexes/datetimes/test_indexing.py index 92134a296b08f..a9ea028c9d0f7 100644 --- a/pandas/tests/indexes/datetimes/test_indexing.py +++ b/pandas/tests/indexes/datetimes/test_indexing.py @@ -7,7 +7,7 @@ from pandas import notnull, Index, DatetimeIndex, datetime, date_range -class TestDatetimeIndex(tm.TestCase): +class TestDatetimeIndex(object): def test_where_other(self): diff --git a/pandas/tests/indexes/datetimes/test_misc.py b/pandas/tests/indexes/datetimes/test_misc.py index d9a61776a0d1c..951aa2c520d0f 100644 --- a/pandas/tests/indexes/datetimes/test_misc.py +++ b/pandas/tests/indexes/datetimes/test_misc.py @@ -7,7 +7,7 @@ Float64Index, date_range, Timestamp) -class TestDateTimeIndexToJulianDate(tm.TestCase): +class TestDateTimeIndexToJulianDate(object): def test_1700(self): r1 = Float64Index([2345897.5, 2345898.5, 2345899.5, 2345900.5, @@ -53,7 +53,7 @@ def test_second(self): tm.assert_index_equal(r1, r2) -class TestTimeSeries(tm.TestCase): +class TestTimeSeries(object): def test_pass_datetimeindex_to_index(self): # Bugs in #1396 @@ -170,7 +170,7 @@ def test_normalize(self): assert not rng.is_normalized -class TestDatetime64(tm.TestCase): +class TestDatetime64(object): def test_datetimeindex_accessors(self): diff --git a/pandas/tests/indexes/datetimes/test_missing.py b/pandas/tests/indexes/datetimes/test_missing.py index 0c356e3251e2f..adc0b7b3d81e8 100644 --- a/pandas/tests/indexes/datetimes/test_missing.py +++ b/pandas/tests/indexes/datetimes/test_missing.py @@ -2,7 +2,7 @@ import pandas.util.testing as tm -class TestDatetimeIndex(tm.TestCase): +class TestDatetimeIndex(object): def test_fillna_datetime64(self): # GH 11343 diff --git a/pandas/tests/indexes/datetimes/test_ops.py b/pandas/tests/indexes/datetimes/test_ops.py index 75c6626b47401..80e93a1f76a66 100644 --- a/pandas/tests/indexes/datetimes/test_ops.py +++ b/pandas/tests/indexes/datetimes/test_ops.py @@ -931,7 +931,7 @@ def test_equals(self): assert not idx.equals(pd.Series(idx3)) -class TestDateTimeIndexToJulianDate(tm.TestCase): +class TestDateTimeIndexToJulianDate(object): def test_1700(self): r1 = Float64Index([2345897.5, 2345898.5, 2345899.5, 2345900.5, @@ -1107,7 +1107,7 @@ def test_shift_months(years, months): tm.assert_index_equal(actual, expected) -class TestBusinessDatetimeIndex(tm.TestCase): +class TestBusinessDatetimeIndex(object): def setup_method(self, method): self.rng = bdate_range(START, END) @@ -1207,7 +1207,7 @@ def test_identical(self): assert not t1.identical(t2v) -class TestCustomDatetimeIndex(tm.TestCase): +class TestCustomDatetimeIndex(object): def setup_method(self, method): self.rng = cdate_range(START, END) diff --git a/pandas/tests/indexes/datetimes/test_partial_slicing.py b/pandas/tests/indexes/datetimes/test_partial_slicing.py index b3661ae0e7a97..e7d03aa193cbd 100644 --- a/pandas/tests/indexes/datetimes/test_partial_slicing.py +++ b/pandas/tests/indexes/datetimes/test_partial_slicing.py @@ -11,7 +11,7 @@ from pandas.util import testing as tm -class TestSlicing(tm.TestCase): +class TestSlicing(object): def test_slice_year(self): dti = DatetimeIndex(freq='B', start=datetime(2005, 1, 1), periods=500) diff --git a/pandas/tests/indexes/datetimes/test_setops.py b/pandas/tests/indexes/datetimes/test_setops.py index fb4b6e9d226f8..f3af7dd30c27f 100644 --- a/pandas/tests/indexes/datetimes/test_setops.py +++ b/pandas/tests/indexes/datetimes/test_setops.py @@ -12,7 +12,7 @@ START, END = datetime(2009, 1, 1), datetime(2010, 1, 1) -class TestDatetimeIndex(tm.TestCase): +class TestDatetimeIndex(object): def test_union(self): i1 = Int64Index(np.arange(0, 20, 2)) @@ -199,7 +199,7 @@ def test_join_nonunique(self): assert rs.is_monotonic -class TestBusinessDatetimeIndex(tm.TestCase): +class TestBusinessDatetimeIndex(object): def setup_method(self, method): self.rng = bdate_range(START, END) @@ -343,7 +343,7 @@ def test_month_range_union_tz_dateutil(self): early_dr.union(late_dr) -class TestCustomDatetimeIndex(tm.TestCase): +class TestCustomDatetimeIndex(object): def setup_method(self, method): self.rng = cdate_range(START, END) diff --git a/pandas/tests/indexes/datetimes/test_tools.py b/pandas/tests/indexes/datetimes/test_tools.py index 3c7f2e424f779..648df01be5289 100644 --- a/pandas/tests/indexes/datetimes/test_tools.py +++ b/pandas/tests/indexes/datetimes/test_tools.py @@ -22,7 +22,7 @@ compat) -class TimeConversionFormats(tm.TestCase): +class TimeConversionFormats(object): def test_to_datetime_format(self): values = ['1/1/2000', '1/2/2000', '1/3/2000'] @@ -170,7 +170,7 @@ def test_to_datetime_format_weeks(self): assert to_datetime(s, format=format) == dt -class TestToDatetime(tm.TestCase): +class TestToDatetime(object): def test_to_datetime_dt64s(self): in_bound_dts = [ @@ -335,7 +335,7 @@ def test_datetime_invalid_datatype(self): pd.to_datetime(pd.to_datetime) -class ToDatetimeUnit(tm.TestCase): +class ToDatetimeUnit(object): def test_unit(self): # GH 11758 @@ -595,7 +595,7 @@ def test_dataframe_dtypes(self): to_datetime(df) -class ToDatetimeMisc(tm.TestCase): +class ToDatetimeMisc(object): def test_index_to_datetime(self): idx = Index(['1/1/2000', '1/2/2000', '1/3/2000']) @@ -829,7 +829,7 @@ def test_dayfirst(self): tm.assert_index_equal(expected, idx6) -class TestGuessDatetimeFormat(tm.TestCase): +class TestGuessDatetimeFormat(object): def test_guess_datetime_format_with_parseable_formats(self): tm._skip_if_not_us_locale() @@ -914,7 +914,7 @@ def test_guess_datetime_format_for_array(self): assert format_for_string_of_nans is None -class TestToDatetimeInferFormat(tm.TestCase): +class TestToDatetimeInferFormat(object): def test_to_datetime_infer_datetime_format_consistent_format(self): s = pd.Series(pd.date_range('20000101', periods=50, freq='H')) @@ -974,7 +974,7 @@ def test_to_datetime_iso8601_noleading_0s(self): tm.assert_series_equal(pd.to_datetime(s, format='%Y-%m-%d'), expected) -class TestDaysInMonth(tm.TestCase): +class TestDaysInMonth(object): # tests for issue #10154 def test_day_not_in_month_coerce(self): @@ -1006,7 +1006,7 @@ def test_day_not_in_month_ignore(self): format="%Y-%m-%d") == '2015-04-31' -class TestDatetimeParsingWrappers(tm.TestCase): +class TestDatetimeParsingWrappers(object): def test_does_not_convert_mixed_integer(self): bad_date_strings = ('-50000', '999', '123.1234', 'm', 'T') @@ -1362,7 +1362,7 @@ def test_parsers_iso8601(self): raise Exception(date_str) -class TestArrayToDatetime(tm.TestCase): +class TestArrayToDatetime(object): def test_try_parse_dates(self): from dateutil.parser import parse diff --git a/pandas/tests/indexes/period/test_asfreq.py b/pandas/tests/indexes/period/test_asfreq.py index b97be3f61a2dd..c8724b2a3bc91 100644 --- a/pandas/tests/indexes/period/test_asfreq.py +++ b/pandas/tests/indexes/period/test_asfreq.py @@ -6,7 +6,7 @@ from pandas import PeriodIndex, Series, DataFrame -class TestPeriodIndex(tm.TestCase): +class TestPeriodIndex(object): def setup_method(self, method): pass diff --git a/pandas/tests/indexes/period/test_construction.py b/pandas/tests/indexes/period/test_construction.py index b0db27b5f2cea..6a188c0987f91 100644 --- a/pandas/tests/indexes/period/test_construction.py +++ b/pandas/tests/indexes/period/test_construction.py @@ -9,7 +9,7 @@ Series, Index) -class TestPeriodIndex(tm.TestCase): +class TestPeriodIndex(object): def setup_method(self, method): pass @@ -473,7 +473,7 @@ def test_map_with_string_constructor(self): tm.assert_index_equal(res, expected) -class TestSeriesPeriod(tm.TestCase): +class TestSeriesPeriod(object): def setup_method(self, method): self.series = Series(period_range('2000-01-01', periods=10, freq='D')) diff --git a/pandas/tests/indexes/period/test_indexing.py b/pandas/tests/indexes/period/test_indexing.py index 36db56b751633..d4dac1cf88fff 100644 --- a/pandas/tests/indexes/period/test_indexing.py +++ b/pandas/tests/indexes/period/test_indexing.py @@ -11,7 +11,7 @@ period_range, Period, _np_version_under1p9) -class TestGetItem(tm.TestCase): +class TestGetItem(object): def setup_method(self, method): pass @@ -200,7 +200,7 @@ def test_getitem_day(self): s[v] -class TestIndexing(tm.TestCase): +class TestIndexing(object): def test_get_loc_msg(self): idx = period_range('2000-1-1', freq='A', periods=10) diff --git a/pandas/tests/indexes/period/test_ops.py b/pandas/tests/indexes/period/test_ops.py index 583848f75c6b4..7acc335c31be4 100644 --- a/pandas/tests/indexes/period/test_ops.py +++ b/pandas/tests/indexes/period/test_ops.py @@ -851,7 +851,7 @@ def test_equals(self): assert not idx.equals(pd.Series(idx3)) -class TestPeriodIndexSeriesMethods(tm.TestCase): +class TestPeriodIndexSeriesMethods(object): """ Test PeriodIndex and Period Series Ops consistency """ def _check(self, values, func, expected): @@ -1135,7 +1135,7 @@ def test_pi_comp_period_nat(self): self._check(idx, f, exp) -class TestSeriesPeriod(tm.TestCase): +class TestSeriesPeriod(object): def setup_method(self, method): self.series = Series(period_range('2000-01-01', periods=10, freq='D')) @@ -1175,7 +1175,7 @@ def test_ops_series_period(self): tm.assert_series_equal(s - s2, -exp) -class TestFramePeriod(tm.TestCase): +class TestFramePeriod(object): def test_ops_frame_period(self): # GH 13043 @@ -1206,7 +1206,7 @@ def test_ops_frame_period(self): tm.assert_frame_equal(df - df2, -exp) -class TestPeriodIndexComparisons(tm.TestCase): +class TestPeriodIndexComparisons(object): def test_pi_pi_comp(self): diff --git a/pandas/tests/indexes/period/test_partial_slicing.py b/pandas/tests/indexes/period/test_partial_slicing.py index 88a9ff5752322..6d142722c315a 100644 --- a/pandas/tests/indexes/period/test_partial_slicing.py +++ b/pandas/tests/indexes/period/test_partial_slicing.py @@ -8,7 +8,7 @@ DataFrame, _np_version_under1p12, Period) -class TestPeriodIndex(tm.TestCase): +class TestPeriodIndex(object): def setup_method(self, method): pass diff --git a/pandas/tests/indexes/period/test_period.py b/pandas/tests/indexes/period/test_period.py index 11ec3bc215cf8..6f73e7c15e4d9 100644 --- a/pandas/tests/indexes/period/test_period.py +++ b/pandas/tests/indexes/period/test_period.py @@ -13,7 +13,7 @@ from ..datetimelike import DatetimeLike -class TestPeriodIndex(DatetimeLike, tm.TestCase): +class TestPeriodIndex(DatetimeLike): _holder = PeriodIndex _multiprocess_can_split_ = True diff --git a/pandas/tests/indexes/period/test_setops.py b/pandas/tests/indexes/period/test_setops.py index 7041724faeb89..1ac05f9fa94b7 100644 --- a/pandas/tests/indexes/period/test_setops.py +++ b/pandas/tests/indexes/period/test_setops.py @@ -12,7 +12,7 @@ def _permute(obj): return obj.take(np.random.permutation(len(obj))) -class TestPeriodIndex(tm.TestCase): +class TestPeriodIndex(object): def setup_method(self, method): pass diff --git a/pandas/tests/indexes/period/test_tools.py b/pandas/tests/indexes/period/test_tools.py index bd80c2c4f341e..074678164e6f9 100644 --- a/pandas/tests/indexes/period/test_tools.py +++ b/pandas/tests/indexes/period/test_tools.py @@ -11,7 +11,7 @@ date_range, to_datetime, period_range) -class TestPeriodRepresentation(tm.TestCase): +class TestPeriodRepresentation(object): """ Wish to match NumPy units """ @@ -73,7 +73,7 @@ def test_negone_ordinals(self): repr(period) -class TestTslib(tm.TestCase): +class TestTslib(object): def test_intraday_conversion_factors(self): assert period_asfreq(1, get_freq('D'), get_freq('H'), False) == 24 assert period_asfreq(1, get_freq('D'), get_freq('T'), False) == 1440 @@ -150,7 +150,7 @@ def test_period_ordinal_business_day(self): 0, 0, 0, 0, get_freq('B')) == 11418 -class TestPeriodIndex(tm.TestCase): +class TestPeriodIndex(object): def setup_method(self, method): pass diff --git a/pandas/tests/indexes/test_base.py b/pandas/tests/indexes/test_base.py index ce3f4b5d68d89..6a2087b37631e 100644 --- a/pandas/tests/indexes/test_base.py +++ b/pandas/tests/indexes/test_base.py @@ -29,7 +29,7 @@ from pandas._libs.lib import Timestamp -class TestIndex(Base, tm.TestCase): +class TestIndex(Base): _holder = Index def setup_method(self, method): @@ -1801,7 +1801,7 @@ def test_string_index_repr(self): assert coerce(idx) == expected -class TestMixedIntIndex(Base, tm.TestCase): +class TestMixedIntIndex(Base): # Mostly the tests from common.py for which the results differ # in py2 and py3 because ints and strings are uncomparable in py3 # (GH 13514) diff --git a/pandas/tests/indexes/test_category.py b/pandas/tests/indexes/test_category.py index 94349b4860698..4e4f9b29f9a4c 100644 --- a/pandas/tests/indexes/test_category.py +++ b/pandas/tests/indexes/test_category.py @@ -19,7 +19,7 @@ unicode = lambda x: x -class TestCategoricalIndex(Base, tm.TestCase): +class TestCategoricalIndex(Base): _holder = CategoricalIndex def setup_method(self, method): diff --git a/pandas/tests/indexes/test_frozen.py b/pandas/tests/indexes/test_frozen.py index ae4a130c24310..ca9841112b1d5 100644 --- a/pandas/tests/indexes/test_frozen.py +++ b/pandas/tests/indexes/test_frozen.py @@ -5,7 +5,7 @@ from pandas.compat import u -class TestFrozenList(CheckImmutable, CheckStringMixin, tm.TestCase): +class TestFrozenList(CheckImmutable, CheckStringMixin): mutable_methods = ('extend', 'pop', 'remove', 'insert') unicode_container = FrozenList([u("\u05d0"), u("\u05d1"), "c"]) @@ -31,7 +31,7 @@ def test_inplace(self): self.check_result(r, self.lst) -class TestFrozenNDArray(CheckImmutable, CheckStringMixin, tm.TestCase): +class TestFrozenNDArray(CheckImmutable, CheckStringMixin): mutable_methods = ('put', 'itemset', 'fill') unicode_container = FrozenNDArray([u("\u05d0"), u("\u05d1"), "c"]) diff --git a/pandas/tests/indexes/test_interval.py b/pandas/tests/indexes/test_interval.py index 90e5b1b6c9788..33745017fe3d6 100644 --- a/pandas/tests/indexes/test_interval.py +++ b/pandas/tests/indexes/test_interval.py @@ -12,7 +12,7 @@ import pandas as pd -class TestIntervalIndex(Base, tm.TestCase): +class TestIntervalIndex(Base): _holder = IntervalIndex def setup_method(self, method): @@ -682,7 +682,7 @@ def f(): pytest.raises(ValueError, f) -class TestIntervalRange(tm.TestCase): +class TestIntervalRange(object): def test_construction(self): result = interval_range(0, 5, name='foo', closed='both') @@ -720,7 +720,7 @@ def f(): pytest.raises(ValueError, f) -class TestIntervalTree(tm.TestCase): +class TestIntervalTree(object): def setup_method(self, method): gentree = lambda dtype: IntervalTree(np.arange(5, dtype=dtype), np.arange(5, dtype=dtype) + 2) diff --git a/pandas/tests/indexes/test_multi.py b/pandas/tests/indexes/test_multi.py index d2024340c522e..402dba0ba08b8 100644 --- a/pandas/tests/indexes/test_multi.py +++ b/pandas/tests/indexes/test_multi.py @@ -27,7 +27,7 @@ from .common import Base -class TestMultiIndex(Base, tm.TestCase): +class TestMultiIndex(Base): _holder = MultiIndex _compat_props = ['shape', 'ndim', 'size', 'itemsize'] diff --git a/pandas/tests/indexes/test_numeric.py b/pandas/tests/indexes/test_numeric.py index e82b1c5e74543..3d06f1672ae32 100644 --- a/pandas/tests/indexes/test_numeric.py +++ b/pandas/tests/indexes/test_numeric.py @@ -176,7 +176,7 @@ def test_modulo(self): tm.assert_index_equal(index % 2, expected) -class TestFloat64Index(Numeric, tm.TestCase): +class TestFloat64Index(Numeric): _holder = Float64Index def setup_method(self, method): @@ -621,7 +621,7 @@ def test_ufunc_coercions(self): tm.assert_index_equal(result, exp) -class TestInt64Index(NumericInt, tm.TestCase): +class TestInt64Index(NumericInt): _dtype = 'int64' _holder = Int64Index @@ -915,7 +915,7 @@ def test_join_outer(self): tm.assert_numpy_array_equal(ridx, eridx) -class TestUInt64Index(NumericInt, tm.TestCase): +class TestUInt64Index(NumericInt): _dtype = 'uint64' _holder = UInt64Index diff --git a/pandas/tests/indexes/test_range.py b/pandas/tests/indexes/test_range.py index cc3a76aa7cac1..18539989084e9 100644 --- a/pandas/tests/indexes/test_range.py +++ b/pandas/tests/indexes/test_range.py @@ -20,7 +20,7 @@ from .test_numeric import Numeric -class TestRangeIndex(Numeric, tm.TestCase): +class TestRangeIndex(Numeric): _holder = RangeIndex _compat_props = ['shape', 'ndim', 'size', 'itemsize'] diff --git a/pandas/tests/indexes/timedeltas/test_astype.py b/pandas/tests/indexes/timedeltas/test_astype.py index b9720f4a300d1..586b96f980f8f 100644 --- a/pandas/tests/indexes/timedeltas/test_astype.py +++ b/pandas/tests/indexes/timedeltas/test_astype.py @@ -10,7 +10,7 @@ from ..datetimelike import DatetimeLike -class TestTimedeltaIndex(DatetimeLike, tm.TestCase): +class TestTimedeltaIndex(DatetimeLike): _holder = TimedeltaIndex _multiprocess_can_split_ = True diff --git a/pandas/tests/indexes/timedeltas/test_construction.py b/pandas/tests/indexes/timedeltas/test_construction.py index bdaa62c5ce221..dd25e2cca2e55 100644 --- a/pandas/tests/indexes/timedeltas/test_construction.py +++ b/pandas/tests/indexes/timedeltas/test_construction.py @@ -8,7 +8,7 @@ from pandas import TimedeltaIndex, timedelta_range, to_timedelta -class TestTimedeltaIndex(tm.TestCase): +class TestTimedeltaIndex(object): _multiprocess_can_split_ = True def test_construction_base_constructor(self): diff --git a/pandas/tests/indexes/timedeltas/test_indexing.py b/pandas/tests/indexes/timedeltas/test_indexing.py index 6ffe3516c4a94..844033cc19eed 100644 --- a/pandas/tests/indexes/timedeltas/test_indexing.py +++ b/pandas/tests/indexes/timedeltas/test_indexing.py @@ -6,7 +6,7 @@ from pandas import TimedeltaIndex, timedelta_range, compat, Index, Timedelta -class TestTimedeltaIndex(tm.TestCase): +class TestTimedeltaIndex(object): _multiprocess_can_split_ = True def test_insert(self): diff --git a/pandas/tests/indexes/timedeltas/test_ops.py b/pandas/tests/indexes/timedeltas/test_ops.py index 12d29dc00e273..9a9912d4f0ab1 100644 --- a/pandas/tests/indexes/timedeltas/test_ops.py +++ b/pandas/tests/indexes/timedeltas/test_ops.py @@ -861,7 +861,7 @@ def test_equals(self): assert not idx.equals(pd.Series(idx2)) -class TestTimedeltas(tm.TestCase): +class TestTimedeltas(object): _multiprocess_can_split_ = True def test_ops(self): @@ -1209,7 +1209,7 @@ def test_compare_timedelta_ndarray(self): tm.assert_numpy_array_equal(result, expected) -class TestSlicing(tm.TestCase): +class TestSlicing(object): def test_tdi_ops_attributes(self): rng = timedelta_range('2 days', periods=5, freq='2D', name='x') diff --git a/pandas/tests/indexes/timedeltas/test_partial_slicing.py b/pandas/tests/indexes/timedeltas/test_partial_slicing.py index 5e6e1440a7c04..8e5eae2a7a3ef 100644 --- a/pandas/tests/indexes/timedeltas/test_partial_slicing.py +++ b/pandas/tests/indexes/timedeltas/test_partial_slicing.py @@ -8,7 +8,7 @@ from pandas.util.testing import assert_series_equal -class TestSlicing(tm.TestCase): +class TestSlicing(object): def test_partial_slice(self): rng = timedelta_range('1 day 10:11:12', freq='h', periods=500) diff --git a/pandas/tests/indexes/timedeltas/test_setops.py b/pandas/tests/indexes/timedeltas/test_setops.py index 8779f6d49cdd5..22546d25273a7 100644 --- a/pandas/tests/indexes/timedeltas/test_setops.py +++ b/pandas/tests/indexes/timedeltas/test_setops.py @@ -5,7 +5,7 @@ from pandas import TimedeltaIndex, timedelta_range, Int64Index -class TestTimedeltaIndex(tm.TestCase): +class TestTimedeltaIndex(object): _multiprocess_can_split_ = True def test_union(self): diff --git a/pandas/tests/indexes/timedeltas/test_timedelta.py b/pandas/tests/indexes/timedeltas/test_timedelta.py index 933674c425cd8..79fe0a864f246 100644 --- a/pandas/tests/indexes/timedeltas/test_timedelta.py +++ b/pandas/tests/indexes/timedeltas/test_timedelta.py @@ -16,7 +16,7 @@ randn = np.random.randn -class TestTimedeltaIndex(DatetimeLike, tm.TestCase): +class TestTimedeltaIndex(DatetimeLike): _holder = TimedeltaIndex _multiprocess_can_split_ = True @@ -563,7 +563,7 @@ def test_freq_conversion(self): assert_index_equal(result, expected) -class TestSlicing(tm.TestCase): +class TestSlicing(object): def test_timedelta(self): # this is valid too @@ -589,7 +589,7 @@ def test_timedelta(self): tm.assert_index_equal(result2, result3) -class TestTimeSeries(tm.TestCase): +class TestTimeSeries(object): _multiprocess_can_split_ = True def test_series_box_timedelta(self): diff --git a/pandas/tests/indexes/timedeltas/test_timedelta_range.py b/pandas/tests/indexes/timedeltas/test_timedelta_range.py index 55f16c10e9945..4732a0ce110de 100644 --- a/pandas/tests/indexes/timedeltas/test_timedelta_range.py +++ b/pandas/tests/indexes/timedeltas/test_timedelta_range.py @@ -7,7 +7,7 @@ from pandas.util.testing import assert_frame_equal -class TestTimedeltas(tm.TestCase): +class TestTimedeltas(object): _multiprocess_can_split_ = True def test_timedelta_range(self): diff --git a/pandas/tests/indexes/timedeltas/test_tools.py b/pandas/tests/indexes/timedeltas/test_tools.py index faee627488dc0..a991b7bbe140a 100644 --- a/pandas/tests/indexes/timedeltas/test_tools.py +++ b/pandas/tests/indexes/timedeltas/test_tools.py @@ -11,7 +11,7 @@ from pandas._libs.tslib import iNaT -class TestTimedeltas(tm.TestCase): +class TestTimedeltas(object): _multiprocess_can_split_ = True def test_to_timedelta(self): diff --git a/pandas/tests/indexing/test_callable.py b/pandas/tests/indexing/test_callable.py index 727c87ac90872..95b406517be62 100644 --- a/pandas/tests/indexing/test_callable.py +++ b/pandas/tests/indexing/test_callable.py @@ -6,7 +6,7 @@ import pandas.util.testing as tm -class TestIndexingCallable(tm.TestCase): +class TestIndexingCallable(object): def test_frame_loc_ix_callable(self): # GH 11485 diff --git a/pandas/tests/indexing/test_categorical.py b/pandas/tests/indexing/test_categorical.py index 6d2723ae0ff01..6874fedaa705f 100644 --- a/pandas/tests/indexing/test_categorical.py +++ b/pandas/tests/indexing/test_categorical.py @@ -10,7 +10,7 @@ from pandas.util import testing as tm -class TestCategoricalIndex(tm.TestCase): +class TestCategoricalIndex(object): def setup_method(self, method): diff --git a/pandas/tests/indexing/test_chaining_and_caching.py b/pandas/tests/indexing/test_chaining_and_caching.py index c1f5d2941106d..27a889e58e55e 100644 --- a/pandas/tests/indexing/test_chaining_and_caching.py +++ b/pandas/tests/indexing/test_chaining_and_caching.py @@ -10,7 +10,7 @@ from pandas.util import testing as tm -class TestCaching(tm.TestCase): +class TestCaching(object): def test_slice_consolidate_invalidate_item_cache(self): @@ -90,7 +90,7 @@ def test_setitem_cache_updating(self): tm.assert_series_equal(out['A'], expected['A']) -class TestChaining(tm.TestCase): +class TestChaining(object): def test_setitem_chained_setfault(self): diff --git a/pandas/tests/indexing/test_coercion.py b/pandas/tests/indexing/test_coercion.py index 8e81a3bd1df7a..25cc810299678 100644 --- a/pandas/tests/indexing/test_coercion.py +++ b/pandas/tests/indexing/test_coercion.py @@ -44,7 +44,7 @@ def test_has_comprehensive_tests(self): raise AssertionError(msg.format(type(self), method_name)) -class TestSetitemCoercion(CoercionBase, tm.TestCase): +class TestSetitemCoercion(CoercionBase): method = 'setitem' @@ -330,7 +330,7 @@ def test_setitem_index_period(self): pass -class TestInsertIndexCoercion(CoercionBase, tm.TestCase): +class TestInsertIndexCoercion(CoercionBase): klasses = ['index'] method = 'insert' @@ -514,7 +514,7 @@ def test_insert_index_period(self): self._assert_insert_conversion(obj, 'x', exp, np.object) -class TestWhereCoercion(CoercionBase, tm.TestCase): +class TestWhereCoercion(CoercionBase): method = 'where' @@ -852,7 +852,7 @@ def test_where_index_period(self): pass -class TestFillnaSeriesCoercion(CoercionBase, tm.TestCase): +class TestFillnaSeriesCoercion(CoercionBase): # not indexing, but place here for consisntency @@ -1139,7 +1139,7 @@ def test_fillna_index_period(self): pass -class TestReplaceSeriesCoercion(CoercionBase, tm.TestCase): +class TestReplaceSeriesCoercion(CoercionBase): # not indexing, but place here for consisntency diff --git a/pandas/tests/indexing/test_datetime.py b/pandas/tests/indexing/test_datetime.py index 3089bc1dbddea..da8a896cb6f4a 100644 --- a/pandas/tests/indexing/test_datetime.py +++ b/pandas/tests/indexing/test_datetime.py @@ -6,7 +6,7 @@ from pandas.util import testing as tm -class TestDatetimeIndex(tm.TestCase): +class TestDatetimeIndex(object): def test_indexing_with_datetime_tz(self): diff --git a/pandas/tests/indexing/test_floats.py b/pandas/tests/indexing/test_floats.py index 1701dd9f6ba90..00a2b8166ceed 100644 --- a/pandas/tests/indexing/test_floats.py +++ b/pandas/tests/indexing/test_floats.py @@ -9,7 +9,7 @@ import pandas.util.testing as tm -class TestFloatIndexers(tm.TestCase): +class TestFloatIndexers(object): def check(self, result, original, indexer, getitem): """ diff --git a/pandas/tests/indexing/test_iloc.py b/pandas/tests/indexing/test_iloc.py index 3e625fa483f7b..af4b9e1f0cc25 100644 --- a/pandas/tests/indexing/test_iloc.py +++ b/pandas/tests/indexing/test_iloc.py @@ -12,7 +12,7 @@ from pandas.tests.indexing.common import Base -class TestiLoc(Base, tm.TestCase): +class TestiLoc(Base): def test_iloc_exceeds_bounds(self): diff --git a/pandas/tests/indexing/test_indexing.py b/pandas/tests/indexing/test_indexing.py index 0759dc2333ad5..9fa677eb624ae 100644 --- a/pandas/tests/indexing/test_indexing.py +++ b/pandas/tests/indexing/test_indexing.py @@ -26,7 +26,7 @@ # Indexing test cases -class TestFancy(Base, tm.TestCase): +class TestFancy(Base): """ pure get/set item & fancy indexing """ def test_setitem_ndarray_1d(self): @@ -599,7 +599,7 @@ def test_index_type_coercion(self): assert s2.index.is_object() -class TestMisc(Base, tm.TestCase): +class TestMisc(Base): def test_indexer_caching(self): # GH5727 @@ -800,7 +800,7 @@ def test_maybe_numeric_slice(self): assert result == expected -class TestSeriesNoneCoercion(tm.TestCase): +class TestSeriesNoneCoercion(object): EXPECTED_RESULTS = [ # For numeric series, we should coerce to NaN. ([1, 2, 3], [np.nan, 2, 3]), @@ -847,7 +847,7 @@ def test_coercion_with_loc_and_series(self): tm.assert_series_equal(start_series, expected_series) -class TestDataframeNoneCoercion(tm.TestCase): +class TestDataframeNoneCoercion(object): EXPECTED_SINGLE_ROW_RESULTS = [ # For numeric series, we should coerce to NaN. ([1, 2, 3], [np.nan, 2, 3]), diff --git a/pandas/tests/indexing/test_indexing_slow.py b/pandas/tests/indexing/test_indexing_slow.py index 21cdbb17f52ce..08d390a6a213e 100644 --- a/pandas/tests/indexing/test_indexing_slow.py +++ b/pandas/tests/indexing/test_indexing_slow.py @@ -8,7 +8,7 @@ import pandas.util.testing as tm -class TestIndexingSlow(tm.TestCase): +class TestIndexingSlow(object): @tm.slow def test_multiindex_get_loc(self): # GH7724, GH2646 diff --git a/pandas/tests/indexing/test_interval.py b/pandas/tests/indexing/test_interval.py index b8d8739af1d15..2552fc066cc87 100644 --- a/pandas/tests/indexing/test_interval.py +++ b/pandas/tests/indexing/test_interval.py @@ -6,7 +6,7 @@ import pandas.util.testing as tm -class TestIntervalIndex(tm.TestCase): +class TestIntervalIndex(object): def setup_method(self, method): self.s = Series(np.arange(5), IntervalIndex.from_breaks(np.arange(6))) diff --git a/pandas/tests/indexing/test_ix.py b/pandas/tests/indexing/test_ix.py index 8290bc80edac1..dc9a591ee3101 100644 --- a/pandas/tests/indexing/test_ix.py +++ b/pandas/tests/indexing/test_ix.py @@ -14,7 +14,7 @@ from pandas.errors import PerformanceWarning -class TestIX(tm.TestCase): +class TestIX(object): def test_ix_deprecation(self): # GH 15114 diff --git a/pandas/tests/indexing/test_loc.py b/pandas/tests/indexing/test_loc.py index 410d01431ef5a..fe2318be72eda 100644 --- a/pandas/tests/indexing/test_loc.py +++ b/pandas/tests/indexing/test_loc.py @@ -14,7 +14,7 @@ from pandas.tests.indexing.common import Base -class TestLoc(Base, tm.TestCase): +class TestLoc(Base): def test_loc_getitem_dups(self): # GH 5678 diff --git a/pandas/tests/indexing/test_multiindex.py b/pandas/tests/indexing/test_multiindex.py index b8c34f9f28d83..483c39ed8694e 100644 --- a/pandas/tests/indexing/test_multiindex.py +++ b/pandas/tests/indexing/test_multiindex.py @@ -9,7 +9,7 @@ from pandas.tests.indexing.common import _mklbl -class TestMultiIndexBasic(tm.TestCase): +class TestMultiIndexBasic(object): def test_iloc_getitem_multiindex2(self): # TODO(wesm): fix this @@ -698,7 +698,7 @@ def test_multiindex_slice_first_level(self): tm.assert_frame_equal(result, expected) -class TestMultiIndexSlicers(tm.TestCase): +class TestMultiIndexSlicers(object): def test_per_axis_per_level_getitem(self): @@ -1188,7 +1188,7 @@ def f(): tm.assert_frame_equal(df, expected) -class TestMultiIndexPanel(tm.TestCase): +class TestMultiIndexPanel(object): def test_iloc_getitem_panel_multiindex(self): diff --git a/pandas/tests/indexing/test_panel.py b/pandas/tests/indexing/test_panel.py index b704e15b81502..2d4ffd6a4e783 100644 --- a/pandas/tests/indexing/test_panel.py +++ b/pandas/tests/indexing/test_panel.py @@ -6,7 +6,7 @@ from pandas import Panel, date_range, DataFrame -class TestPanel(tm.TestCase): +class TestPanel(object): def test_iloc_getitem_panel(self): diff --git a/pandas/tests/indexing/test_partial.py b/pandas/tests/indexing/test_partial.py index 20cec2a3aa7db..93a85e247a787 100644 --- a/pandas/tests/indexing/test_partial.py +++ b/pandas/tests/indexing/test_partial.py @@ -14,7 +14,7 @@ from pandas.util import testing as tm -class TestPartialSetting(tm.TestCase): +class TestPartialSetting(object): def test_partial_setting(self): diff --git a/pandas/tests/indexing/test_scalar.py b/pandas/tests/indexing/test_scalar.py index fb40c539e16ba..5dd1714b903eb 100644 --- a/pandas/tests/indexing/test_scalar.py +++ b/pandas/tests/indexing/test_scalar.py @@ -10,7 +10,7 @@ from pandas.tests.indexing.common import Base -class TestScalar(Base, tm.TestCase): +class TestScalar(Base): def test_at_and_iat_get(self): def _check(f, func, values=False): diff --git a/pandas/tests/indexing/test_timedelta.py b/pandas/tests/indexing/test_timedelta.py index 5f0088382ce57..cf8cc6c2d345d 100644 --- a/pandas/tests/indexing/test_timedelta.py +++ b/pandas/tests/indexing/test_timedelta.py @@ -2,7 +2,7 @@ from pandas.util import testing as tm -class TestTimedeltaIndexing(tm.TestCase): +class TestTimedeltaIndexing(object): def test_boolean_indexing(self): # GH 14946 diff --git a/pandas/tests/io/formats/test_eng_formatting.py b/pandas/tests/io/formats/test_eng_formatting.py index e064d1200d672..9d5773283176c 100644 --- a/pandas/tests/io/formats/test_eng_formatting.py +++ b/pandas/tests/io/formats/test_eng_formatting.py @@ -6,7 +6,7 @@ from pandas.util import testing as tm -class TestEngFormatter(tm.TestCase): +class TestEngFormatter(object): def test_eng_float_formatter(self): df = DataFrame({'A': [1.41, 141., 14100, 1410000.]}) diff --git a/pandas/tests/io/formats/test_format.py b/pandas/tests/io/formats/test_format.py index 3cea731cfd440..e99c70952e5b3 100644 --- a/pandas/tests/io/formats/test_format.py +++ b/pandas/tests/io/formats/test_format.py @@ -105,7 +105,7 @@ def has_expanded_repr(df): return False -class TestDataFrameFormatting(tm.TestCase): +class TestDataFrameFormatting(object): def setup_method(self, method): self.warn_filters = warnings.filters @@ -1604,7 +1604,7 @@ def gen_series_formatting(): return test_sers -class TestSeriesFormatting(tm.TestCase): +class TestSeriesFormatting(object): def setup_method(self, method): self.ts = tm.makeTimeSeries() @@ -2152,7 +2152,7 @@ def _three_digit_exp(): return '%.4g' % 1.7e8 == '1.7e+008' -class TestFloatArrayFormatter(tm.TestCase): +class TestFloatArrayFormatter(object): def test_misc(self): obj = fmt.FloatArrayFormatter(np.array([], dtype=np.float64)) @@ -2238,7 +2238,7 @@ def test_too_long(self): assert str(df) == ' x\n0 1.2346e+04\n1 2.0000e+06' -class TestRepr_timedelta64(tm.TestCase): +class TestRepr_timedelta64(object): def test_none(self): delta_1d = pd.to_timedelta(1, unit='D') @@ -2311,7 +2311,7 @@ def test_all(self): assert drepr(delta_1ns) == "0 days 00:00:00.000000001" -class TestTimedelta64Formatter(tm.TestCase): +class TestTimedelta64Formatter(object): def test_days(self): x = pd.to_timedelta(list(range(5)) + [pd.NaT], unit='D') @@ -2357,7 +2357,7 @@ def test_zero(self): assert result[0].strip() == "'0 days'" -class TestDatetime64Formatter(tm.TestCase): +class TestDatetime64Formatter(object): def test_mixed(self): x = Series([datetime(2013, 1, 1), datetime(2013, 1, 1, 12), pd.NaT]) @@ -2438,7 +2438,7 @@ def format_func(x): assert result == ['10:10', '12:12'] -class TestNaTFormatting(tm.TestCase): +class TestNaTFormatting(object): def test_repr(self): assert repr(pd.NaT) == "NaT" @@ -2447,7 +2447,7 @@ def test_str(self): assert str(pd.NaT) == "NaT" -class TestDatetimeIndexFormat(tm.TestCase): +class TestDatetimeIndexFormat(object): def test_datetime(self): formatted = pd.to_datetime([datetime(2003, 1, 1, 12), pd.NaT]).format() @@ -2474,7 +2474,7 @@ def test_date_explict_date_format(self): assert formatted[1] == "UT" -class TestDatetimeIndexUnicode(tm.TestCase): +class TestDatetimeIndexUnicode(object): def test_dates(self): text = str(pd.to_datetime([datetime(2013, 1, 1), datetime(2014, 1, 1) @@ -2489,7 +2489,7 @@ def test_mixed(self): assert "'2014-01-01 00:00:00']" in text -class TestStringRepTimestamp(tm.TestCase): +class TestStringRepTimestamp(object): def test_no_tz(self): dt_date = datetime(2013, 1, 2) diff --git a/pandas/tests/io/formats/test_printing.py b/pandas/tests/io/formats/test_printing.py index 05b697ffbb756..aae3ba31648ff 100644 --- a/pandas/tests/io/formats/test_printing.py +++ b/pandas/tests/io/formats/test_printing.py @@ -7,7 +7,6 @@ from pandas import compat import pandas.io.formats.printing as printing import pandas.io.formats.format as fmt -import pandas.util.testing as tm import pandas.core.config as cf @@ -35,7 +34,7 @@ def test_repr_binary_type(): assert res == b -class TestFormattBase(tm.TestCase): +class TestFormattBase(object): def test_adjoin(self): data = [['a', 'b', 'c'], ['dd', 'ee', 'ff'], ['ggg', 'hhh', 'iii']] @@ -123,7 +122,7 @@ def test_ambiguous_width(self): assert adjoined == expected -class TestTableSchemaRepr(tm.TestCase): +class TestTableSchemaRepr(object): @classmethod def setup_class(cls): diff --git a/pandas/tests/io/formats/test_style.py b/pandas/tests/io/formats/test_style.py index 687e78e64a3e7..ee7356f12f498 100644 --- a/pandas/tests/io/formats/test_style.py +++ b/pandas/tests/io/formats/test_style.py @@ -11,7 +11,7 @@ from pandas.io.formats.style import Styler, _get_level_lengths # noqa -class TestStyler(tm.TestCase): +class TestStyler(object): def setup_method(self, method): np.random.seed(24) @@ -812,7 +812,7 @@ def test_mi_sparse_column_names(self): assert head == expected -class TestStylerMatplotlibDep(tm.TestCase): +class TestStylerMatplotlibDep(object): def test_background_gradient(self): tm._skip_if_no_mpl() diff --git a/pandas/tests/io/formats/test_to_csv.py b/pandas/tests/io/formats/test_to_csv.py index 552fb77bb54cc..1073fbcef5aec 100644 --- a/pandas/tests/io/formats/test_to_csv.py +++ b/pandas/tests/io/formats/test_to_csv.py @@ -4,7 +4,7 @@ from pandas.util import testing as tm -class TestToCSV(tm.TestCase): +class TestToCSV(object): def test_to_csv_quotechar(self): df = DataFrame({'col': [1, 2]}) diff --git a/pandas/tests/io/formats/test_to_html.py b/pandas/tests/io/formats/test_to_html.py index 4a4546dd807f1..cde920b1511d2 100644 --- a/pandas/tests/io/formats/test_to_html.py +++ b/pandas/tests/io/formats/test_to_html.py @@ -22,7 +22,7 @@ pass -class TestToHTML(tm.TestCase): +class TestToHTML(object): def test_to_html_with_col_space(self): def check_with_width(df, col_space): diff --git a/pandas/tests/io/json/test_json_table_schema.py b/pandas/tests/io/json/test_json_table_schema.py index 1e667245809ec..e447a74b2b462 100644 --- a/pandas/tests/io/json/test_json_table_schema.py +++ b/pandas/tests/io/json/test_json_table_schema.py @@ -9,7 +9,6 @@ from pandas import DataFrame from pandas.core.dtypes.dtypes import ( PeriodDtype, CategoricalDtype, DatetimeTZDtype) -import pandas.util.testing as tm from pandas.io.json.table_schema import ( as_json_table_type, build_table_schema, @@ -17,7 +16,7 @@ set_default_names) -class TestBuildSchema(tm.TestCase): +class TestBuildSchema(object): def setup_method(self, method): self.df = DataFrame( @@ -85,7 +84,7 @@ def test_multiindex(self): assert result == expected -class TestTableSchemaType(tm.TestCase): +class TestTableSchemaType(object): def test_as_json_table_type_int_data(self): int_data = [1, 2, 3] @@ -169,7 +168,7 @@ def test_as_json_table_type_categorical_dtypes(self): assert as_json_table_type(CategoricalDtype()) == 'any' -class TestTableOrient(tm.TestCase): +class TestTableOrient(object): def setup_method(self, method): self.df = DataFrame( diff --git a/pandas/tests/io/json/test_normalize.py b/pandas/tests/io/json/test_normalize.py index d24250f534521..49b765b18d623 100644 --- a/pandas/tests/io/json/test_normalize.py +++ b/pandas/tests/io/json/test_normalize.py @@ -212,7 +212,7 @@ def test_non_ascii_key(self): tm.assert_frame_equal(result, expected) -class TestNestedToRecord(tm.TestCase): +class TestNestedToRecord(object): def test_flat_stays_flat(self): recs = [dict(flat1=1, flat2=2), diff --git a/pandas/tests/io/json/test_pandas.py b/pandas/tests/io/json/test_pandas.py index 0cf9000fcffb2..671d4248818e4 100644 --- a/pandas/tests/io/json/test_pandas.py +++ b/pandas/tests/io/json/test_pandas.py @@ -35,7 +35,7 @@ _mixed_frame = _frame.copy() -class TestPandasContainer(tm.TestCase): +class TestPandasContainer(object): def setup_method(self, method): self.dirpath = tm.get_data_path() diff --git a/pandas/tests/io/json/test_ujson.py b/pandas/tests/io/json/test_ujson.py index a23ae225c19b0..10f99c4fcd0a8 100644 --- a/pandas/tests/io/json/test_ujson.py +++ b/pandas/tests/io/json/test_ujson.py @@ -25,7 +25,7 @@ else partial(json.dumps, encoding="utf-8")) -class UltraJSONTests(tm.TestCase): +class UltraJSONTests(object): @pytest.mark.skipif(compat.is_platform_32bit(), reason="not compliant on 32-bit, xref #15865") @@ -946,7 +946,7 @@ def my_obj_handler(obj): ujson.decode(ujson.encode(l, default_handler=str))) -class NumpyJSONTests(tm.TestCase): +class NumpyJSONTests(object): def testBool(self): b = np.bool(True) @@ -1222,7 +1222,7 @@ def testArrayNumpyLabelled(self): assert (np.array(['a', 'b']) == output[2]).all() -class PandasJSONTests(tm.TestCase): +class PandasJSONTests(object): def testDataFrame(self): df = DataFrame([[1, 2, 3], [4, 5, 6]], index=[ diff --git a/pandas/tests/io/msgpack/test_limits.py b/pandas/tests/io/msgpack/test_limits.py index e906d14a2b5a8..07044dbb7e5de 100644 --- a/pandas/tests/io/msgpack/test_limits.py +++ b/pandas/tests/io/msgpack/test_limits.py @@ -4,12 +4,10 @@ import pytest -import pandas.util.testing as tm - from pandas.io.msgpack import packb, unpackb, Packer, Unpacker, ExtType -class TestLimits(tm.TestCase): +class TestLimits(object): def test_integer(self): x = -(2 ** 63) diff --git a/pandas/tests/io/msgpack/test_unpack.py b/pandas/tests/io/msgpack/test_unpack.py index 158094d111b54..c056f8d800e11 100644 --- a/pandas/tests/io/msgpack/test_unpack.py +++ b/pandas/tests/io/msgpack/test_unpack.py @@ -1,11 +1,10 @@ from io import BytesIO import sys from pandas.io.msgpack import Unpacker, packb, OutOfData, ExtType -import pandas.util.testing as tm import pytest -class TestUnpack(tm.TestCase): +class TestUnpack(object): def test_unpack_array_header_from_file(self): f = BytesIO(packb([1, 2, 3, 4])) diff --git a/pandas/tests/io/parser/test_network.py b/pandas/tests/io/parser/test_network.py index 26b5c4788d53a..e12945a6a3102 100644 --- a/pandas/tests/io/parser/test_network.py +++ b/pandas/tests/io/parser/test_network.py @@ -47,7 +47,7 @@ def check_compressed_urls(salaries_table, compression, extension, mode, tm.assert_frame_equal(url_table, salaries_table) -class TestS3(tm.TestCase): +class TestS3(object): def setup_method(self, method): try: diff --git a/pandas/tests/io/parser/test_parsers.py b/pandas/tests/io/parser/test_parsers.py index cced8299691df..8d59e3acb3230 100644 --- a/pandas/tests/io/parser/test_parsers.py +++ b/pandas/tests/io/parser/test_parsers.py @@ -50,7 +50,7 @@ def setup_method(self, method): self.csv_shiftjs = os.path.join(self.dirpath, 'sauron.SHIFT_JIS.csv') -class TestCParserHighMemory(BaseParser, CParserTests, tm.TestCase): +class TestCParserHighMemory(BaseParser, CParserTests): engine = 'c' low_memory = False float_precision_choices = [None, 'high', 'round_trip'] @@ -68,7 +68,7 @@ def read_table(self, *args, **kwds): return read_table(*args, **kwds) -class TestCParserLowMemory(BaseParser, CParserTests, tm.TestCase): +class TestCParserLowMemory(BaseParser, CParserTests): engine = 'c' low_memory = True float_precision_choices = [None, 'high', 'round_trip'] @@ -86,7 +86,7 @@ def read_table(self, *args, **kwds): return read_table(*args, **kwds) -class TestPythonParser(BaseParser, PythonParserTests, tm.TestCase): +class TestPythonParser(BaseParser, PythonParserTests): engine = 'python' float_precision_choices = [None] diff --git a/pandas/tests/io/parser/test_read_fwf.py b/pandas/tests/io/parser/test_read_fwf.py index 90231e01d0173..0bfeb5215f370 100644 --- a/pandas/tests/io/parser/test_read_fwf.py +++ b/pandas/tests/io/parser/test_read_fwf.py @@ -19,7 +19,7 @@ from pandas.io.parsers import read_csv, read_fwf, EmptyDataError -class TestFwfParsing(tm.TestCase): +class TestFwfParsing(object): def test_fwf(self): data_expected = """\ diff --git a/pandas/tests/io/parser/test_textreader.py b/pandas/tests/io/parser/test_textreader.py index f09d8c8e778d5..7cd02a07bbd4c 100644 --- a/pandas/tests/io/parser/test_textreader.py +++ b/pandas/tests/io/parser/test_textreader.py @@ -26,7 +26,7 @@ import pandas.io.libparsers as parser -class TestTextReader(tm.TestCase): +class TestTextReader(object): def setup_method(self, method): self.dirpath = tm.get_data_path() diff --git a/pandas/tests/io/parser/test_unsupported.py b/pandas/tests/io/parser/test_unsupported.py index 6c2d883aeb16b..3f62ff44531fb 100644 --- a/pandas/tests/io/parser/test_unsupported.py +++ b/pandas/tests/io/parser/test_unsupported.py @@ -17,7 +17,7 @@ from pandas.io.parsers import read_csv, read_table -class TestUnsupportedFeatures(tm.TestCase): +class TestUnsupportedFeatures(object): def test_mangle_dupe_cols_false(self): # see gh-12935 @@ -102,7 +102,7 @@ def test_python_engine(self): read_csv(StringIO(data), engine=engine, **kwargs) -class TestDeprecatedFeatures(tm.TestCase): +class TestDeprecatedFeatures(object): def test_deprecated_args(self): data = '1,2,3' diff --git a/pandas/tests/io/sas/test_sas.py b/pandas/tests/io/sas/test_sas.py index 461c0fe1fd848..617df99b99f0b 100644 --- a/pandas/tests/io/sas/test_sas.py +++ b/pandas/tests/io/sas/test_sas.py @@ -1,11 +1,10 @@ import pytest -import pandas.util.testing as tm from pandas.compat import StringIO from pandas import read_sas -class TestSas(tm.TestCase): +class TestSas(object): def test_sas_buffer_format(self): diff --git a/pandas/tests/io/sas/test_sas7bdat.py b/pandas/tests/io/sas/test_sas7bdat.py index cb28ab6c6c345..a5157744038f4 100644 --- a/pandas/tests/io/sas/test_sas7bdat.py +++ b/pandas/tests/io/sas/test_sas7bdat.py @@ -6,7 +6,7 @@ import numpy as np -class TestSAS7BDAT(tm.TestCase): +class TestSAS7BDAT(object): def setup_method(self, method): self.dirpath = tm.get_data_path() diff --git a/pandas/tests/io/sas/test_xport.py b/pandas/tests/io/sas/test_xport.py index 17b286a4915ce..de31c3e36a8d5 100644 --- a/pandas/tests/io/sas/test_xport.py +++ b/pandas/tests/io/sas/test_xport.py @@ -16,7 +16,7 @@ def numeric_as_float(data): data[v] = data[v].astype(np.float64) -class TestXport(tm.TestCase): +class TestXport(object): def setup_method(self, method): self.dirpath = tm.get_data_path() diff --git a/pandas/tests/io/test_clipboard.py b/pandas/tests/io/test_clipboard.py index e9ffb2dca7ae5..406045a69beca 100644 --- a/pandas/tests/io/test_clipboard.py +++ b/pandas/tests/io/test_clipboard.py @@ -23,11 +23,10 @@ @pytest.mark.single @pytest.mark.skipif(not _DEPS_INSTALLED, reason="clipboard primitives not installed") -class TestClipboard(tm.TestCase): +class TestClipboard(object): @classmethod def setup_class(cls): - super(TestClipboard, cls).setup_class() cls.data = {} cls.data['string'] = mkdf(5, 3, c_idx_type='s', r_idx_type='i', c_idx_names=[None], r_idx_names=[None]) @@ -63,7 +62,6 @@ def setup_class(cls): @classmethod def teardown_class(cls): - super(TestClipboard, cls).teardown_class() del cls.data_types, cls.data def check_round_trip_frame(self, data_type, excel=None, sep=None, diff --git a/pandas/tests/io/test_common.py b/pandas/tests/io/test_common.py index 1837e5381a07e..a1a95e09915f1 100644 --- a/pandas/tests/io/test_common.py +++ b/pandas/tests/io/test_common.py @@ -24,7 +24,7 @@ pass -class TestCommonIOCapabilities(tm.TestCase): +class TestCommonIOCapabilities(object): data1 = """index,A,B,C,D foo,2,3,4,5 bar,7,8,9,10 @@ -90,7 +90,7 @@ def test_iterator(self): tm.assert_frame_equal(concat(it), expected.iloc[1:]) -class TestMMapWrapper(tm.TestCase): +class TestMMapWrapper(object): def setup_method(self, method): self.mmap_file = os.path.join(tm.get_data_path(), diff --git a/pandas/tests/io/test_excel.py b/pandas/tests/io/test_excel.py index 919c521f22f60..c70b5937fea3f 100644 --- a/pandas/tests/io/test_excel.py +++ b/pandas/tests/io/test_excel.py @@ -989,19 +989,19 @@ def test_read_excel_squeeze(self): tm.assert_series_equal(actual, expected) -class XlsReaderTests(XlrdTests, tm.TestCase): +class XlsReaderTests(XlrdTests): ext = '.xls' engine_name = 'xlrd' check_skip = staticmethod(_skip_if_no_xlrd) -class XlsxReaderTests(XlrdTests, tm.TestCase): +class XlsxReaderTests(XlrdTests): ext = '.xlsx' engine_name = 'xlrd' check_skip = staticmethod(_skip_if_no_xlrd) -class XlsmReaderTests(XlrdTests, tm.TestCase): +class XlsmReaderTests(XlrdTests): ext = '.xlsm' engine_name = 'xlrd' check_skip = staticmethod(_skip_if_no_xlrd) @@ -1887,7 +1887,7 @@ def versioned_raise_on_incompat_version(cls): @raise_on_incompat_version(1) -class OpenpyxlTests(ExcelWriterBase, tm.TestCase): +class OpenpyxlTests(ExcelWriterBase): ext = '.xlsx' engine_name = 'openpyxl1' check_skip = staticmethod(lambda *args, **kwargs: None) @@ -1923,7 +1923,7 @@ def test_to_excel_styleconverter(self): def skip_openpyxl_gt21(cls): - """Skip a TestCase instance if openpyxl >= 2.2""" + """Skip test case if openpyxl >= 2.2""" @classmethod def setup_class(cls): @@ -1940,7 +1940,7 @@ def setup_class(cls): @raise_on_incompat_version(2) @skip_openpyxl_gt21 -class Openpyxl20Tests(ExcelWriterBase, tm.TestCase): +class Openpyxl20Tests(ExcelWriterBase): ext = '.xlsx' engine_name = 'openpyxl20' check_skip = staticmethod(lambda *args, **kwargs: None) @@ -2040,7 +2040,7 @@ def test_write_cells_merge_styled(self): def skip_openpyxl_lt22(cls): - """Skip a TestCase instance if openpyxl < 2.2""" + """Skip test case if openpyxl < 2.2""" @classmethod def setup_class(cls): @@ -2056,7 +2056,7 @@ def setup_class(cls): @raise_on_incompat_version(2) @skip_openpyxl_lt22 -class Openpyxl22Tests(ExcelWriterBase, tm.TestCase): +class Openpyxl22Tests(ExcelWriterBase): ext = '.xlsx' engine_name = 'openpyxl22' check_skip = staticmethod(lambda *args, **kwargs: None) @@ -2151,7 +2151,7 @@ def test_write_cells_merge_styled(self): assert xcell_a2.font == openpyxl_sty_merged -class XlwtTests(ExcelWriterBase, tm.TestCase): +class XlwtTests(ExcelWriterBase): ext = '.xls' engine_name = 'xlwt' check_skip = staticmethod(_skip_if_no_xlwt) @@ -2208,7 +2208,7 @@ def test_to_excel_styleconverter(self): assert xlwt.Alignment.VERT_TOP == xls_style.alignment.vert -class XlsxWriterTests(ExcelWriterBase, tm.TestCase): +class XlsxWriterTests(ExcelWriterBase): ext = '.xlsx' engine_name = 'xlsxwriter' check_skip = staticmethod(_skip_if_no_xlsxwriter) @@ -2261,7 +2261,7 @@ def test_column_format(self): assert read_num_format == num_format -class OpenpyxlTests_NoMerge(ExcelWriterBase, tm.TestCase): +class OpenpyxlTests_NoMerge(ExcelWriterBase): ext = '.xlsx' engine_name = 'openpyxl' check_skip = staticmethod(_skip_if_no_openpyxl) @@ -2270,7 +2270,7 @@ class OpenpyxlTests_NoMerge(ExcelWriterBase, tm.TestCase): merge_cells = False -class XlwtTests_NoMerge(ExcelWriterBase, tm.TestCase): +class XlwtTests_NoMerge(ExcelWriterBase): ext = '.xls' engine_name = 'xlwt' check_skip = staticmethod(_skip_if_no_xlwt) @@ -2279,7 +2279,7 @@ class XlwtTests_NoMerge(ExcelWriterBase, tm.TestCase): merge_cells = False -class XlsxWriterTests_NoMerge(ExcelWriterBase, tm.TestCase): +class XlsxWriterTests_NoMerge(ExcelWriterBase): ext = '.xlsx' engine_name = 'xlsxwriter' check_skip = staticmethod(_skip_if_no_xlsxwriter) @@ -2288,7 +2288,7 @@ class XlsxWriterTests_NoMerge(ExcelWriterBase, tm.TestCase): merge_cells = False -class ExcelWriterEngineTests(tm.TestCase): +class ExcelWriterEngineTests(object): def test_ExcelWriter_dispatch(self): with tm.assert_raises_regex(ValueError, 'No engine'): diff --git a/pandas/tests/io/test_gbq.py b/pandas/tests/io/test_gbq.py index 47fc495201754..58a84ad4d47f8 100644 --- a/pandas/tests/io/test_gbq.py +++ b/pandas/tests/io/test_gbq.py @@ -10,7 +10,6 @@ from pandas import compat, DataFrame from pandas.compat import range -import pandas.util.testing as tm pandas_gbq = pytest.importorskip('pandas_gbq') @@ -94,7 +93,7 @@ def make_mixed_dataframe_v2(test_size): @pytest.mark.single -class TestToGBQIntegrationWithServiceAccountKeyPath(tm.TestCase): +class TestToGBQIntegrationWithServiceAccountKeyPath(object): @classmethod def setup_class(cls): diff --git a/pandas/tests/io/test_html.py b/pandas/tests/io/test_html.py index 6b1215e443b47..fa83c43ba8dd4 100644 --- a/pandas/tests/io/test_html.py +++ b/pandas/tests/io/test_html.py @@ -93,14 +93,13 @@ def read_html(self, *args, **kwargs): return read_html(*args, **kwargs) -class TestReadHtml(tm.TestCase, ReadHtmlMixin): +class TestReadHtml(ReadHtmlMixin): flavor = 'bs4' spam_data = os.path.join(DATA_PATH, 'spam.html') banklist_data = os.path.join(DATA_PATH, 'banklist.html') @classmethod def setup_class(cls): - super(TestReadHtml, cls).setup_class() _skip_if_none_of(('bs4', 'html5lib')) def test_to_html_compat(self): @@ -778,13 +777,12 @@ def _lang_enc(filename): return os.path.splitext(os.path.basename(filename))[0].split('_') -class TestReadHtmlEncoding(tm.TestCase): +class TestReadHtmlEncoding(object): files = glob.glob(os.path.join(DATA_PATH, 'html_encoding', '*.html')) flavor = 'bs4' @classmethod def setup_class(cls): - super(TestReadHtmlEncoding, cls).setup_class() _skip_if_none_of((cls.flavor, 'html5lib')) def read_html(self, *args, **kwargs): @@ -830,12 +828,11 @@ def setup_class(cls): _skip_if_no(cls.flavor) -class TestReadHtmlLxml(tm.TestCase, ReadHtmlMixin): +class TestReadHtmlLxml(ReadHtmlMixin): flavor = 'lxml' @classmethod def setup_class(cls): - super(TestReadHtmlLxml, cls).setup_class() _skip_if_no('lxml') def test_data_fail(self): diff --git a/pandas/tests/io/test_packers.py b/pandas/tests/io/test_packers.py index 96abf3415fff8..4b1145129c364 100644 --- a/pandas/tests/io/test_packers.py +++ b/pandas/tests/io/test_packers.py @@ -90,7 +90,7 @@ def check_arbitrary(a, b): assert(a == b) -class TestPackers(tm.TestCase): +class TestPackers(object): def setup_method(self, method): self.path = '__%s__.msg' % tm.rands(10) diff --git a/pandas/tests/io/test_pytables.py b/pandas/tests/io/test_pytables.py index 9e7196593650a..ee44fea55e51a 100644 --- a/pandas/tests/io/test_pytables.py +++ b/pandas/tests/io/test_pytables.py @@ -121,18 +121,16 @@ def _maybe_remove(store, key): pass -class Base(tm.TestCase): +class Base(object): @classmethod def setup_class(cls): - super(Base, cls).setup_class() # Pytables 3.0.0 deprecates lots of things tm.reset_testing_mode() @classmethod def teardown_class(cls): - super(Base, cls).teardown_class() # Pytables 3.0.0 deprecates lots of things tm.set_testing_mode() @@ -145,7 +143,7 @@ def teardown_method(self, method): @pytest.mark.single -class TestHDFStore(Base, tm.TestCase): +class TestHDFStore(Base): def test_factory_fun(self): path = create_tempfile(self.path) @@ -5228,7 +5226,7 @@ def test_complex_append(self): assert_frame_equal(pd.concat([df, df], 0), result) -class TestTimezones(Base, tm.TestCase): +class TestTimezones(Base): def _compare_with_tz(self, a, b): tm.assert_frame_equal(a, b) diff --git a/pandas/tests/io/test_s3.py b/pandas/tests/io/test_s3.py index 36a0304bddfaf..8c2a32af33765 100644 --- a/pandas/tests/io/test_s3.py +++ b/pandas/tests/io/test_s3.py @@ -1,9 +1,7 @@ -from pandas.util import testing as tm - from pandas.io.common import _is_s3_url -class TestS3URL(tm.TestCase): +class TestS3URL(object): def test_is_s3_url(self): assert _is_s3_url("s3://pandas/somethingelse.com") diff --git a/pandas/tests/io/test_sql.py b/pandas/tests/io/test_sql.py index 21de0cd371a37..7b3717281bf89 100644 --- a/pandas/tests/io/test_sql.py +++ b/pandas/tests/io/test_sql.py @@ -818,7 +818,7 @@ def test_unicode_column_name(self): @pytest.mark.single -class TestSQLApi(SQLAlchemyMixIn, _TestSQLApi, tm.TestCase): +class TestSQLApi(SQLAlchemyMixIn, _TestSQLApi): """ Test the public API as it would be used directly @@ -998,12 +998,12 @@ def teardown_method(self, method): @pytest.mark.single -class TestSQLApiConn(_EngineToConnMixin, TestSQLApi, tm.TestCase): +class TestSQLApiConn(_EngineToConnMixin, TestSQLApi): pass @pytest.mark.single -class TestSQLiteFallbackApi(SQLiteMixIn, _TestSQLApi, tm.TestCase): +class TestSQLiteFallbackApi(SQLiteMixIn, _TestSQLApi): """ Test the public sqlite connection fallback API @@ -1821,37 +1821,32 @@ def test_schema_support(self): @pytest.mark.single -class TestMySQLAlchemy(_TestMySQLAlchemy, _TestSQLAlchemy, tm.TestCase): +class TestMySQLAlchemy(_TestMySQLAlchemy, _TestSQLAlchemy): pass @pytest.mark.single -class TestMySQLAlchemyConn(_TestMySQLAlchemy, _TestSQLAlchemyConn, - tm.TestCase): +class TestMySQLAlchemyConn(_TestMySQLAlchemy, _TestSQLAlchemyConn): pass @pytest.mark.single -class TestPostgreSQLAlchemy(_TestPostgreSQLAlchemy, _TestSQLAlchemy, - tm.TestCase): +class TestPostgreSQLAlchemy(_TestPostgreSQLAlchemy, _TestSQLAlchemy): pass @pytest.mark.single -class TestPostgreSQLAlchemyConn(_TestPostgreSQLAlchemy, _TestSQLAlchemyConn, - tm.TestCase): +class TestPostgreSQLAlchemyConn(_TestPostgreSQLAlchemy, _TestSQLAlchemyConn): pass @pytest.mark.single -class TestSQLiteAlchemy(_TestSQLiteAlchemy, _TestSQLAlchemy, - tm.TestCase): +class TestSQLiteAlchemy(_TestSQLiteAlchemy, _TestSQLAlchemy): pass @pytest.mark.single -class TestSQLiteAlchemyConn(_TestSQLiteAlchemy, _TestSQLAlchemyConn, - tm.TestCase): +class TestSQLiteAlchemyConn(_TestSQLiteAlchemy, _TestSQLAlchemyConn): pass @@ -1859,7 +1854,7 @@ class TestSQLiteAlchemyConn(_TestSQLiteAlchemy, _TestSQLAlchemyConn, # -- Test Sqlite / MySQL fallback @pytest.mark.single -class TestSQLiteFallback(SQLiteMixIn, PandasSQLTest, tm.TestCase): +class TestSQLiteFallback(SQLiteMixIn, PandasSQLTest): """ Test the fallback mode against an in-memory sqlite database. @@ -2083,7 +2078,7 @@ def _skip_if_no_pymysql(): @pytest.mark.single -class TestXSQLite(SQLiteMixIn, tm.TestCase): +class TestXSQLite(SQLiteMixIn): def setup_method(self, method): self.method = method @@ -2287,7 +2282,7 @@ def clean_up(test_table_to_drop): @pytest.mark.single -class TestSQLFlavorDeprecation(tm.TestCase): +class TestSQLFlavorDeprecation(object): """ gh-13611: test that the 'flavor' parameter is appropriately deprecated by checking the @@ -2314,7 +2309,7 @@ def test_deprecated_flavor(self): @pytest.mark.single @pytest.mark.skip(reason="gh-13611: there is no support for MySQL " "if SQLAlchemy is not installed") -class TestXMySQL(MySQLMixIn, tm.TestCase): +class TestXMySQL(MySQLMixIn): @classmethod def setup_class(cls): diff --git a/pandas/tests/io/test_stata.py b/pandas/tests/io/test_stata.py index 7867e6866876a..4c92c19c51e7a 100644 --- a/pandas/tests/io/test_stata.py +++ b/pandas/tests/io/test_stata.py @@ -23,7 +23,7 @@ from pandas.core.dtypes.common import is_categorical_dtype -class TestStata(tm.TestCase): +class TestStata(object): def setup_method(self, method): self.dirpath = tm.get_data_path() diff --git a/pandas/tests/plotting/common.py b/pandas/tests/plotting/common.py index 9a24e4ae2dad0..ac490a00bf684 100644 --- a/pandas/tests/plotting/common.py +++ b/pandas/tests/plotting/common.py @@ -42,7 +42,7 @@ def _ok_for_gaussian_kde(kind): return True -class TestPlotBase(tm.TestCase): +class TestPlotBase(object): def setup_method(self, method): diff --git a/pandas/tests/plotting/test_converter.py b/pandas/tests/plotting/test_converter.py index 21d8d1f0ab555..e1f64bed5598d 100644 --- a/pandas/tests/plotting/test_converter.py +++ b/pandas/tests/plotting/test_converter.py @@ -15,7 +15,7 @@ def test_timtetonum_accepts_unicode(): assert (converter.time2num("00:01") == converter.time2num(u("00:01"))) -class TestDateTimeConverter(tm.TestCase): +class TestDateTimeConverter(object): def setup_method(self, method): self.dtc = converter.DatetimeConverter() @@ -146,7 +146,7 @@ def test_convert_nested(self): assert result == expected -class TestPeriodConverter(tm.TestCase): +class TestPeriodConverter(object): def setup_method(self, method): self.pc = converter.PeriodConverter() diff --git a/pandas/tests/reshape/test_concat.py b/pandas/tests/reshape/test_concat.py index 1842af465ca89..4dfa2904313ce 100644 --- a/pandas/tests/reshape/test_concat.py +++ b/pandas/tests/reshape/test_concat.py @@ -17,7 +17,7 @@ import pytest -class ConcatenateBase(tm.TestCase): +class ConcatenateBase(object): def setup_method(self, method): self.frame = DataFrame(tm.getSeriesData()) diff --git a/pandas/tests/reshape/test_hashing.py b/pandas/tests/reshape/test_hashing.py index 622768353dd50..5f2c67ee300b5 100644 --- a/pandas/tests/reshape/test_hashing.py +++ b/pandas/tests/reshape/test_hashing.py @@ -9,7 +9,7 @@ import pandas.util.testing as tm -class TestHashing(tm.TestCase): +class TestHashing(object): def setup_method(self, method): self.df = DataFrame( diff --git a/pandas/tests/reshape/test_join.py b/pandas/tests/reshape/test_join.py index 3a6985fd4a373..e25661fb65271 100644 --- a/pandas/tests/reshape/test_join.py +++ b/pandas/tests/reshape/test_join.py @@ -19,7 +19,7 @@ a_ = np.array -class TestJoin(tm.TestCase): +class TestJoin(object): def setup_method(self, method): # aggregate multiple columns diff --git a/pandas/tests/reshape/test_merge.py b/pandas/tests/reshape/test_merge.py index e36b7ecbc3c7b..d3257243d7a2c 100644 --- a/pandas/tests/reshape/test_merge.py +++ b/pandas/tests/reshape/test_merge.py @@ -33,7 +33,7 @@ def get_test_data(ngroups=NGROUPS, n=N): return arr -class TestMerge(tm.TestCase): +class TestMerge(object): def setup_method(self, method): # aggregate multiple columns @@ -737,7 +737,7 @@ def _check_merge(x, y): assert_frame_equal(result, expected, check_names=False) -class TestMergeMulti(tm.TestCase): +class TestMergeMulti(object): def setup_method(self, method): self.index = MultiIndex(levels=[['foo', 'bar', 'baz', 'qux'], diff --git a/pandas/tests/reshape/test_merge_asof.py b/pandas/tests/reshape/test_merge_asof.py index 7e33449c92665..78bfa2ff8597c 100644 --- a/pandas/tests/reshape/test_merge_asof.py +++ b/pandas/tests/reshape/test_merge_asof.py @@ -11,7 +11,7 @@ from pandas.util.testing import assert_frame_equal -class TestAsOfMerge(tm.TestCase): +class TestAsOfMerge(object): def read_data(self, name, dedupe=False): path = os.path.join(tm.get_data_path(), name) diff --git a/pandas/tests/reshape/test_merge_ordered.py b/pandas/tests/reshape/test_merge_ordered.py index 375e2e13847e8..9469e98f336fd 100644 --- a/pandas/tests/reshape/test_merge_ordered.py +++ b/pandas/tests/reshape/test_merge_ordered.py @@ -6,7 +6,7 @@ from numpy import nan -class TestOrderedMerge(tm.TestCase): +class TestOrderedMerge(object): def setup_method(self, method): self.left = DataFrame({'key': ['a', 'c', 'e'], diff --git a/pandas/tests/reshape/test_pivot.py b/pandas/tests/reshape/test_pivot.py index 905cd27ca4c58..270a93e4ae382 100644 --- a/pandas/tests/reshape/test_pivot.py +++ b/pandas/tests/reshape/test_pivot.py @@ -15,7 +15,7 @@ from pandas.tseries.util import pivot_annual, isleapyear -class TestPivotTable(tm.TestCase): +class TestPivotTable(object): def setup_method(self, method): self.data = DataFrame({'A': ['foo', 'foo', 'foo', 'foo', @@ -982,7 +982,7 @@ def test_pivot_table_not_series(self): tm.assert_frame_equal(result, expected) -class TestCrosstab(tm.TestCase): +class TestCrosstab(object): def setup_method(self, method): df = DataFrame({'A': ['foo', 'foo', 'foo', 'foo', @@ -1397,7 +1397,7 @@ def test_crosstab_with_numpy_size(self): tm.assert_frame_equal(result, expected) -class TestPivotAnnual(tm.TestCase): +class TestPivotAnnual(object): """ New pandas of scikits.timeseries pivot_annual """ diff --git a/pandas/tests/reshape/test_reshape.py b/pandas/tests/reshape/test_reshape.py index de2fe444bc4ea..79626d89026a7 100644 --- a/pandas/tests/reshape/test_reshape.py +++ b/pandas/tests/reshape/test_reshape.py @@ -17,7 +17,7 @@ from pandas.compat import range, u -class TestMelt(tm.TestCase): +class TestMelt(object): def setup_method(self, method): self.df = tm.makeTimeDataFrame()[:10] @@ -216,7 +216,7 @@ def test_multiindex(self): assert res.columns.tolist() == ['CAP', 'low', 'value'] -class TestGetDummies(tm.TestCase): +class TestGetDummies(object): sparse = False @@ -644,7 +644,7 @@ class TestGetDummiesSparse(TestGetDummies): sparse = True -class TestMakeAxisDummies(tm.TestCase): +class TestMakeAxisDummies(object): def test_preserve_categorical_dtype(self): # GH13854 @@ -665,7 +665,7 @@ def test_preserve_categorical_dtype(self): tm.assert_frame_equal(result, expected) -class TestLreshape(tm.TestCase): +class TestLreshape(object): def test_pairs(self): data = {'birthdt': ['08jan2009', '20dec2008', '30dec2008', '21dec2008', @@ -737,7 +737,7 @@ def test_pairs(self): pytest.raises(ValueError, lreshape, df, spec) -class TestWideToLong(tm.TestCase): +class TestWideToLong(object): def test_simple(self): np.random.seed(123) diff --git a/pandas/tests/reshape/test_tile.py b/pandas/tests/reshape/test_tile.py index 2291030a2735c..8602b33856fea 100644 --- a/pandas/tests/reshape/test_tile.py +++ b/pandas/tests/reshape/test_tile.py @@ -14,7 +14,7 @@ import pandas.core.reshape.tile as tmod -class TestCut(tm.TestCase): +class TestCut(object): def test_simple(self): data = np.ones(5, dtype='int64') diff --git a/pandas/tests/reshape/test_union_categoricals.py b/pandas/tests/reshape/test_union_categoricals.py index 5cc476718add2..fe8d54005ba9b 100644 --- a/pandas/tests/reshape/test_union_categoricals.py +++ b/pandas/tests/reshape/test_union_categoricals.py @@ -7,7 +7,7 @@ from pandas.util import testing as tm -class TestUnionCategoricals(tm.TestCase): +class TestUnionCategoricals(object): def test_union_categorical(self): # GH 13361 diff --git a/pandas/tests/reshape/test_util.py b/pandas/tests/reshape/test_util.py index a7fbe8d305011..e4a9591b95c26 100644 --- a/pandas/tests/reshape/test_util.py +++ b/pandas/tests/reshape/test_util.py @@ -5,7 +5,7 @@ from pandas.core.reshape.util import cartesian_product -class TestCartesianProduct(tm.TestCase): +class TestCartesianProduct(object): def test_simple(self): x, y = list('ABC'), [1, 22] diff --git a/pandas/tests/scalar/test_interval.py b/pandas/tests/scalar/test_interval.py index fab6f170bec60..e06f7cb34eb52 100644 --- a/pandas/tests/scalar/test_interval.py +++ b/pandas/tests/scalar/test_interval.py @@ -5,7 +5,7 @@ import pandas.util.testing as tm -class TestInterval(tm.TestCase): +class TestInterval(object): def setup_method(self, method): self.interval = Interval(0, 1) diff --git a/pandas/tests/scalar/test_period.py b/pandas/tests/scalar/test_period.py index 8c89fa60b12d6..54366dc9b1c3f 100644 --- a/pandas/tests/scalar/test_period.py +++ b/pandas/tests/scalar/test_period.py @@ -14,7 +14,7 @@ from pandas.tseries.frequencies import DAYS, MONTHS -class TestPeriodProperties(tm.TestCase): +class TestPeriodProperties(object): "Test properties such as year, month, weekday, etc...." def test_is_leap_year(self): @@ -911,7 +911,7 @@ def test_round_trip(self): assert new_p == p -class TestPeriodField(tm.TestCase): +class TestPeriodField(object): def test_get_period_field_raises_on_out_of_range(self): pytest.raises(ValueError, libperiod.get_period_field, -1, 0, 0) @@ -921,7 +921,7 @@ def test_get_period_field_array_raises_on_out_of_range(self): np.empty(1), 0) -class TestComparisons(tm.TestCase): +class TestComparisons(object): def setup_method(self, method): self.january1 = Period('2000-01', 'M') @@ -1006,7 +1006,7 @@ def test_period_nat_comp(self): assert not left >= right -class TestMethods(tm.TestCase): +class TestMethods(object): def test_add(self): dt1 = Period(freq='D', year=2008, month=1, day=1) diff --git a/pandas/tests/scalar/test_period_asfreq.py b/pandas/tests/scalar/test_period_asfreq.py index 7011cfeef90ae..32cea60c333b7 100644 --- a/pandas/tests/scalar/test_period_asfreq.py +++ b/pandas/tests/scalar/test_period_asfreq.py @@ -4,7 +4,7 @@ from pandas.tseries.frequencies import _period_code_map -class TestFreqConversion(tm.TestCase): +class TestFreqConversion(object): """Test frequency conversion of date objects""" def test_asfreq_corner(self): diff --git a/pandas/tests/scalar/test_timedelta.py b/pandas/tests/scalar/test_timedelta.py index 82d6f6e8c84e5..ecc44204924d3 100644 --- a/pandas/tests/scalar/test_timedelta.py +++ b/pandas/tests/scalar/test_timedelta.py @@ -12,7 +12,7 @@ from pandas._libs.tslib import iNaT, NaTType -class TestTimedeltas(tm.TestCase): +class TestTimedeltas(object): _multiprocess_can_split_ = True def setup_method(self, method): diff --git a/pandas/tests/scalar/test_timestamp.py b/pandas/tests/scalar/test_timestamp.py index 64f68112f4b81..5caa0252b69b8 100644 --- a/pandas/tests/scalar/test_timestamp.py +++ b/pandas/tests/scalar/test_timestamp.py @@ -22,7 +22,7 @@ RESO_MS, RESO_SEC) -class TestTimestamp(tm.TestCase): +class TestTimestamp(object): def test_constructor(self): base_str = '2014-07-01 09:00' @@ -1094,7 +1094,7 @@ def test_is_leap_year(self): assert not dt.is_leap_year -class TestTimestampNsOperations(tm.TestCase): +class TestTimestampNsOperations(object): def setup_method(self, method): self.timestamp = Timestamp(datetime.utcnow()) @@ -1181,7 +1181,7 @@ def test_nanosecond_timestamp(self): assert t.nanosecond == 10 -class TestTimestampOps(tm.TestCase): +class TestTimestampOps(object): def test_timestamp_and_datetime(self): assert ((Timestamp(datetime(2013, 10, 13)) - @@ -1256,7 +1256,7 @@ def test_resolution(self): assert result == expected -class TestTimestampToJulianDate(tm.TestCase): +class TestTimestampToJulianDate(object): def test_compare_1700(self): r = Timestamp('1700-06-23').to_julian_date() @@ -1279,7 +1279,7 @@ def test_compare_hour13(self): assert r == 2451769.0416666666666666 -class TestTimeSeries(tm.TestCase): +class TestTimeSeries(object): def test_timestamp_to_datetime(self): tm._skip_if_no_pytz() @@ -1490,7 +1490,7 @@ def test_woy_boundary(self): assert (result == [52, 52, 53, 53]).all() -class TestTsUtil(tm.TestCase): +class TestTsUtil(object): def test_min_valid(self): # Ensure that Timestamp.min is a valid Timestamp diff --git a/pandas/tests/series/test_alter_axes.py b/pandas/tests/series/test_alter_axes.py index 33a4cdb6e26c4..150767ee9e2b2 100644 --- a/pandas/tests/series/test_alter_axes.py +++ b/pandas/tests/series/test_alter_axes.py @@ -18,7 +18,7 @@ from .common import TestData -class TestSeriesAlterAxes(TestData, tm.TestCase): +class TestSeriesAlterAxes(TestData): def test_setindex(self): # wrong type diff --git a/pandas/tests/series/test_analytics.py b/pandas/tests/series/test_analytics.py index 71131452393a7..257f992f57f6d 100644 --- a/pandas/tests/series/test_analytics.py +++ b/pandas/tests/series/test_analytics.py @@ -28,7 +28,7 @@ from .common import TestData -class TestSeriesAnalytics(TestData, tm.TestCase): +class TestSeriesAnalytics(TestData): def test_sum_zero(self): arr = np.array([]) diff --git a/pandas/tests/series/test_api.py b/pandas/tests/series/test_api.py index 5bb463c7a2ebe..1eb2b98a7d7cc 100644 --- a/pandas/tests/series/test_api.py +++ b/pandas/tests/series/test_api.py @@ -118,7 +118,7 @@ def test_to_sparse_pass_name(self): assert result.name == self.ts.name -class TestSeriesMisc(TestData, SharedWithSparse, tm.TestCase): +class TestSeriesMisc(TestData, SharedWithSparse): def test_tab_completion(self): # GH 9910 diff --git a/pandas/tests/series/test_apply.py b/pandas/tests/series/test_apply.py index 089a2c36a5574..c273d3161fff5 100644 --- a/pandas/tests/series/test_apply.py +++ b/pandas/tests/series/test_apply.py @@ -17,7 +17,7 @@ from .common import TestData -class TestSeriesApply(TestData, tm.TestCase): +class TestSeriesApply(TestData): def test_apply(self): with np.errstate(all='ignore'): @@ -151,7 +151,7 @@ def test_apply_dict_depr(self): tsdf.A.agg({'foo': ['sum', 'mean']}) -class TestSeriesAggregate(TestData, tm.TestCase): +class TestSeriesAggregate(TestData): _multiprocess_can_split_ = True @@ -307,7 +307,7 @@ def test_reduce(self): assert_series_equal(result, expected) -class TestSeriesMap(TestData, tm.TestCase): +class TestSeriesMap(TestData): def test_map(self): index, data = tm.getMixedTypeDict() diff --git a/pandas/tests/series/test_asof.py b/pandas/tests/series/test_asof.py index a839d571c116c..1f62d618b20e1 100644 --- a/pandas/tests/series/test_asof.py +++ b/pandas/tests/series/test_asof.py @@ -11,7 +11,7 @@ from .common import TestData -class TestSeriesAsof(TestData, tm.TestCase): +class TestSeriesAsof(TestData): def test_basic(self): diff --git a/pandas/tests/series/test_combine_concat.py b/pandas/tests/series/test_combine_concat.py index 1291449ae7ce9..bb998b7fa55dd 100644 --- a/pandas/tests/series/test_combine_concat.py +++ b/pandas/tests/series/test_combine_concat.py @@ -18,7 +18,7 @@ from .common import TestData -class TestSeriesCombine(TestData, tm.TestCase): +class TestSeriesCombine(TestData): def test_append(self): appendedSeries = self.series.append(self.objSeries) @@ -217,7 +217,7 @@ def test_combine_first_dt64(self): assert_series_equal(rs, xp) -class TestTimeseries(tm.TestCase): +class TestTimeseries(object): def test_append_concat(self): rng = date_range('5/8/2012 1:45', periods=10, freq='5T') diff --git a/pandas/tests/series/test_constructors.py b/pandas/tests/series/test_constructors.py index a0a68a332f735..d591aa4f567a9 100644 --- a/pandas/tests/series/test_constructors.py +++ b/pandas/tests/series/test_constructors.py @@ -28,7 +28,7 @@ from .common import TestData -class TestSeriesConstructors(TestData, tm.TestCase): +class TestSeriesConstructors(TestData): def test_invalid_dtype(self): # GH15520 diff --git a/pandas/tests/series/test_datetime_values.py b/pandas/tests/series/test_datetime_values.py index 50914eef1abc8..e1fc9af0cca89 100644 --- a/pandas/tests/series/test_datetime_values.py +++ b/pandas/tests/series/test_datetime_values.py @@ -20,7 +20,7 @@ from .common import TestData -class TestSeriesDatetimeValues(TestData, tm.TestCase): +class TestSeriesDatetimeValues(TestData): def test_dt_namespace_accessor(self): diff --git a/pandas/tests/series/test_indexing.py b/pandas/tests/series/test_indexing.py index 8eae59a473995..7f876357ad3ab 100644 --- a/pandas/tests/series/test_indexing.py +++ b/pandas/tests/series/test_indexing.py @@ -31,7 +31,7 @@ JOIN_TYPES = ['inner', 'outer', 'left', 'right'] -class TestSeriesIndexing(TestData, tm.TestCase): +class TestSeriesIndexing(TestData): def test_get(self): @@ -2252,7 +2252,7 @@ def test_setitem_slice_into_readonly_backing_data(self): assert not array.any() -class TestTimeSeriesDuplicates(tm.TestCase): +class TestTimeSeriesDuplicates(object): def setup_method(self, method): dates = [datetime(2000, 1, 2), datetime(2000, 1, 2), @@ -2494,7 +2494,7 @@ def test_indexing(self): pytest.raises(KeyError, df.__getitem__, df.index[2], ) -class TestDatetimeIndexing(tm.TestCase): +class TestDatetimeIndexing(object): """ Also test support for datetime64[ns] in Series / DataFrame """ @@ -2638,7 +2638,7 @@ def test_frame_datetime64_duplicated(self): assert (-result).all() -class TestNatIndexing(tm.TestCase): +class TestNatIndexing(object): def setup_method(self, method): self.series = Series(date_range('1/1/2000', periods=10)) diff --git a/pandas/tests/series/test_internals.py b/pandas/tests/series/test_internals.py index 31492a4ab214a..79e23459ac992 100644 --- a/pandas/tests/series/test_internals.py +++ b/pandas/tests/series/test_internals.py @@ -16,7 +16,7 @@ import pandas.util.testing as tm -class TestSeriesInternals(tm.TestCase): +class TestSeriesInternals(object): def test_convert_objects(self): diff --git a/pandas/tests/series/test_io.py b/pandas/tests/series/test_io.py index 24bb3bbc7fc16..d1c9e5a6d16cf 100644 --- a/pandas/tests/series/test_io.py +++ b/pandas/tests/series/test_io.py @@ -16,7 +16,7 @@ from .common import TestData -class TestSeriesToCSV(TestData, tm.TestCase): +class TestSeriesToCSV(TestData): def test_from_csv(self): @@ -108,7 +108,7 @@ def test_to_csv_path_is_none(self): assert isinstance(csv_str, str) -class TestSeriesIO(TestData, tm.TestCase): +class TestSeriesIO(TestData): def test_to_frame(self): self.ts.name = None @@ -168,7 +168,7 @@ class SubclassedFrame(DataFrame): assert_frame_equal(result, expected) -class TestSeriesToList(TestData, tm.TestCase): +class TestSeriesToList(TestData): def test_tolist(self): rs = self.ts.tolist() diff --git a/pandas/tests/series/test_missing.py b/pandas/tests/series/test_missing.py index 0eaab2e588cc2..c52c41877d5c0 100644 --- a/pandas/tests/series/test_missing.py +++ b/pandas/tests/series/test_missing.py @@ -48,7 +48,7 @@ def _simple_ts(start, end, freq='D'): return Series(np.random.randn(len(rng)), index=rng) -class TestSeriesMissingData(TestData, tm.TestCase): +class TestSeriesMissingData(TestData): def test_timedelta_fillna(self): # GH 3371 @@ -700,7 +700,7 @@ def test_series_pad_backfill_limit(self): assert_series_equal(result, expected) -class TestSeriesInterpolateData(TestData, tm.TestCase): +class TestSeriesInterpolateData(TestData): def test_interpolate(self): ts = Series(np.arange(len(self.ts), dtype=float), self.ts.index) diff --git a/pandas/tests/series/test_operators.py b/pandas/tests/series/test_operators.py index 7c7b98961d960..db0d06aa35a2a 100644 --- a/pandas/tests/series/test_operators.py +++ b/pandas/tests/series/test_operators.py @@ -28,7 +28,7 @@ from .common import TestData -class TestSeriesOperators(TestData, tm.TestCase): +class TestSeriesOperators(TestData): def test_series_comparison_scalars(self): series = Series(date_range('1/1/2000', periods=10)) diff --git a/pandas/tests/series/test_period.py b/pandas/tests/series/test_period.py index 792d5b9e5c383..6e8ee38d366e2 100644 --- a/pandas/tests/series/test_period.py +++ b/pandas/tests/series/test_period.py @@ -10,7 +10,7 @@ def _permute(obj): return obj.take(np.random.permutation(len(obj))) -class TestSeriesPeriod(tm.TestCase): +class TestSeriesPeriod(object): def setup_method(self, method): self.series = Series(period_range('2000-01-01', periods=10, freq='D')) diff --git a/pandas/tests/series/test_quantile.py b/pandas/tests/series/test_quantile.py index 6d2cdd046ea7f..2d02260ac7303 100644 --- a/pandas/tests/series/test_quantile.py +++ b/pandas/tests/series/test_quantile.py @@ -13,7 +13,7 @@ from .common import TestData -class TestSeriesQuantile(TestData, tm.TestCase): +class TestSeriesQuantile(TestData): def test_quantile(self): diff --git a/pandas/tests/series/test_rank.py b/pandas/tests/series/test_rank.py index 1a1829eb5829f..ff489eb7f15b1 100644 --- a/pandas/tests/series/test_rank.py +++ b/pandas/tests/series/test_rank.py @@ -15,7 +15,7 @@ from pandas.tests.series.common import TestData -class TestSeriesRank(tm.TestCase, TestData): +class TestSeriesRank(TestData): s = Series([1, 3, 4, 2, nan, 2, 1, 5, nan, 3]) results = { diff --git a/pandas/tests/series/test_replace.py b/pandas/tests/series/test_replace.py index 19a99c8351db8..35d13a62ca083 100644 --- a/pandas/tests/series/test_replace.py +++ b/pandas/tests/series/test_replace.py @@ -11,7 +11,7 @@ from .common import TestData -class TestSeriesReplace(TestData, tm.TestCase): +class TestSeriesReplace(TestData): def test_replace(self): N = 100 ser = pd.Series(np.random.randn(N)) diff --git a/pandas/tests/series/test_repr.py b/pandas/tests/series/test_repr.py index 8c1d74c5c2c23..3af61b0a902d3 100644 --- a/pandas/tests/series/test_repr.py +++ b/pandas/tests/series/test_repr.py @@ -18,7 +18,7 @@ from .common import TestData -class TestSeriesRepr(TestData, tm.TestCase): +class TestSeriesRepr(TestData): def test_multilevel_name_print(self): index = MultiIndex(levels=[['foo', 'bar', 'baz', 'qux'], ['one', 'two', diff --git a/pandas/tests/series/test_sorting.py b/pandas/tests/series/test_sorting.py index 791a7d5db9a26..40b0280de3719 100644 --- a/pandas/tests/series/test_sorting.py +++ b/pandas/tests/series/test_sorting.py @@ -13,7 +13,7 @@ from .common import TestData -class TestSeriesSorting(TestData, tm.TestCase): +class TestSeriesSorting(TestData): def test_sortlevel_deprecated(self): ts = self.ts.copy() diff --git a/pandas/tests/series/test_subclass.py b/pandas/tests/series/test_subclass.py index fe8a5e7658d9c..37c8d7343f7f1 100644 --- a/pandas/tests/series/test_subclass.py +++ b/pandas/tests/series/test_subclass.py @@ -6,7 +6,7 @@ import pandas.util.testing as tm -class TestSeriesSubclassing(tm.TestCase): +class TestSeriesSubclassing(object): def test_indexing_sliced(self): s = tm.SubclassedSeries([1, 2, 3, 4], index=list('abcd')) @@ -33,7 +33,7 @@ def test_to_frame(self): assert isinstance(res, tm.SubclassedDataFrame) -class TestSparseSeriesSubclassing(tm.TestCase): +class TestSparseSeriesSubclassing(object): def test_subclass_sparse_slice(self): # int64 diff --git a/pandas/tests/series/test_timeseries.py b/pandas/tests/series/test_timeseries.py index 78e5d87636532..d5517bdcceac7 100644 --- a/pandas/tests/series/test_timeseries.py +++ b/pandas/tests/series/test_timeseries.py @@ -33,7 +33,7 @@ def assert_range_equal(left, right): assert (left.tz == right.tz) -class TestTimeSeries(TestData, tm.TestCase): +class TestTimeSeries(TestData): def test_shift(self): shifted = self.ts.shift(1) diff --git a/pandas/tests/sparse/test_arithmetics.py b/pandas/tests/sparse/test_arithmetics.py index 468d856ca68ce..f023cd0003910 100644 --- a/pandas/tests/sparse/test_arithmetics.py +++ b/pandas/tests/sparse/test_arithmetics.py @@ -3,7 +3,7 @@ import pandas.util.testing as tm -class TestSparseArrayArithmetics(tm.TestCase): +class TestSparseArrayArithmetics(object): _base = np.array _klass = pd.SparseArray diff --git a/pandas/tests/sparse/test_array.py b/pandas/tests/sparse/test_array.py index c205a1efbeeb1..ab7340c89f016 100644 --- a/pandas/tests/sparse/test_array.py +++ b/pandas/tests/sparse/test_array.py @@ -15,7 +15,7 @@ import pandas.util.testing as tm -class TestSparseArray(tm.TestCase): +class TestSparseArray(object): def setup_method(self, method): self.arr_data = np.array([nan, nan, 1, 2, 3, nan, 4, 5, nan, 6]) @@ -656,7 +656,7 @@ def test_fillna_overlap(self): tm.assert_sp_array_equal(res, exp) -class TestSparseArrayAnalytics(tm.TestCase): +class TestSparseArrayAnalytics(object): def test_sum(self): data = np.arange(10).astype(float) diff --git a/pandas/tests/sparse/test_combine_concat.py b/pandas/tests/sparse/test_combine_concat.py index ab56a83c90530..15639fbe156c6 100644 --- a/pandas/tests/sparse/test_combine_concat.py +++ b/pandas/tests/sparse/test_combine_concat.py @@ -5,7 +5,7 @@ import pandas.util.testing as tm -class TestSparseSeriesConcat(tm.TestCase): +class TestSparseSeriesConcat(object): def test_concat(self): val1 = np.array([1, 2, np.nan, np.nan, 0, np.nan]) @@ -122,7 +122,7 @@ def test_concat_sparse_dense(self): tm.assert_sp_series_equal(res, exp) -class TestSparseDataFrameConcat(tm.TestCase): +class TestSparseDataFrameConcat(object): def setup_method(self, method): diff --git a/pandas/tests/sparse/test_format.py b/pandas/tests/sparse/test_format.py index 74be14ff5cf15..d983bd209085a 100644 --- a/pandas/tests/sparse/test_format.py +++ b/pandas/tests/sparse/test_format.py @@ -13,7 +13,7 @@ use_32bit_repr = is_platform_windows() or is_platform_32bit() -class TestSparseSeriesFormatting(tm.TestCase): +class TestSparseSeriesFormatting(object): @property def dtype_format_for_platform(self): @@ -105,7 +105,7 @@ def test_sparse_int(self): assert result == exp -class TestSparseDataFrameFormatting(tm.TestCase): +class TestSparseDataFrameFormatting(object): def test_sparse_frame(self): # GH 13110 diff --git a/pandas/tests/sparse/test_frame.py b/pandas/tests/sparse/test_frame.py index 762bfba85dd0a..4a4a596e3bed4 100644 --- a/pandas/tests/sparse/test_frame.py +++ b/pandas/tests/sparse/test_frame.py @@ -26,7 +26,7 @@ from pandas.tests.frame.test_api import SharedWithSparse -class TestSparseDataFrame(tm.TestCase, SharedWithSparse): +class TestSparseDataFrame(SharedWithSparse): klass = SparseDataFrame def setup_method(self, method): @@ -1245,7 +1245,7 @@ def test_from_to_scipy_object(spmatrix, fill_value): assert sdf.to_coo().dtype == res_dtype -class TestSparseDataFrameArithmetic(tm.TestCase): +class TestSparseDataFrameArithmetic(object): def test_numeric_op_scalar(self): df = pd.DataFrame({'A': [nan, nan, 0, 1, ], @@ -1274,7 +1274,7 @@ def test_comparison_op_scalar(self): tm.assert_frame_equal(res.to_dense(), df != 0) -class TestSparseDataFrameAnalytics(tm.TestCase): +class TestSparseDataFrameAnalytics(object): def setup_method(self, method): self.data = {'A': [nan, nan, nan, 0, 1, 2, 3, 4, 5, 6], 'B': [0, 1, 2, nan, nan, nan, 3, 4, 5, 6], diff --git a/pandas/tests/sparse/test_groupby.py b/pandas/tests/sparse/test_groupby.py index 501e40c6ebffd..c9049ed9743dd 100644 --- a/pandas/tests/sparse/test_groupby.py +++ b/pandas/tests/sparse/test_groupby.py @@ -4,7 +4,7 @@ import pandas.util.testing as tm -class TestSparseGroupBy(tm.TestCase): +class TestSparseGroupBy(object): def setup_method(self, method): self.dense = pd.DataFrame({'A': ['foo', 'bar', 'foo', 'bar', diff --git a/pandas/tests/sparse/test_indexing.py b/pandas/tests/sparse/test_indexing.py index bb449c05729d4..382cff4b9d0ac 100644 --- a/pandas/tests/sparse/test_indexing.py +++ b/pandas/tests/sparse/test_indexing.py @@ -6,7 +6,7 @@ import pandas.util.testing as tm -class TestSparseSeriesIndexing(tm.TestCase): +class TestSparseSeriesIndexing(object): def setup_method(self, method): self.orig = pd.Series([1, np.nan, np.nan, 3, np.nan]) @@ -589,7 +589,7 @@ def test_reindex(self): assert sparse is not res -class TestSparseDataFrameIndexing(tm.TestCase): +class TestSparseDataFrameIndexing(object): def test_getitem(self): orig = pd.DataFrame([[1, np.nan, np.nan], @@ -952,7 +952,7 @@ def test_reindex_fill_value(self): tm.assert_sp_frame_equal(res, exp) -class TestMultitype(tm.TestCase): +class TestMultitype(object): def setup_method(self, method): self.cols = ['string', 'int', 'float', 'object'] diff --git a/pandas/tests/sparse/test_libsparse.py b/pandas/tests/sparse/test_libsparse.py index c7207870b22b9..c41025582c651 100644 --- a/pandas/tests/sparse/test_libsparse.py +++ b/pandas/tests/sparse/test_libsparse.py @@ -42,7 +42,7 @@ def _check_case_dict(case): _check_case([], [], [], [], [], []) -class TestSparseIndexUnion(tm.TestCase): +class TestSparseIndexUnion(object): def test_index_make_union(self): def _check_case(xloc, xlen, yloc, ylen, eloc, elen): @@ -188,7 +188,7 @@ def test_intindex_make_union(self): a.make_union(b) -class TestSparseIndexIntersect(tm.TestCase): +class TestSparseIndexIntersect(object): def test_intersect(self): def _check_correct(a, b, expected): @@ -239,7 +239,7 @@ def test_intersect_identical(self): assert case.intersect(case).equals(case) -class TestSparseIndexCommon(tm.TestCase): +class TestSparseIndexCommon(object): def test_int_internal(self): idx = _make_index(4, np.array([2, 3], dtype=np.int32), kind='integer') @@ -387,7 +387,7 @@ def _check(index): # corner cases -class TestBlockIndex(tm.TestCase): +class TestBlockIndex(object): def test_block_internal(self): idx = _make_index(4, np.array([2, 3], dtype=np.int32), kind='block') @@ -472,7 +472,7 @@ def test_to_block_index(self): assert index.to_block_index() is index -class TestIntIndex(tm.TestCase): +class TestIntIndex(object): def test_check_integrity(self): @@ -557,7 +557,7 @@ def test_to_int_index(self): assert index.to_int_index() is index -class TestSparseOperators(tm.TestCase): +class TestSparseOperators(object): def _op_tests(self, sparse_op, python_op): def _check_case(xloc, xlen, yloc, ylen, eloc, elen): diff --git a/pandas/tests/sparse/test_list.py b/pandas/tests/sparse/test_list.py index 3eab34661ae2b..6c721ca813a21 100644 --- a/pandas/tests/sparse/test_list.py +++ b/pandas/tests/sparse/test_list.py @@ -7,7 +7,7 @@ import pandas.util.testing as tm -class TestSparseList(tm.TestCase): +class TestSparseList(object): def setup_method(self, method): self.na_data = np.array([nan, nan, 1, 2, 3, nan, 4, 5, nan, 6]) diff --git a/pandas/tests/sparse/test_pivot.py b/pandas/tests/sparse/test_pivot.py index 57c47b4e68811..e7eba63e4e0b3 100644 --- a/pandas/tests/sparse/test_pivot.py +++ b/pandas/tests/sparse/test_pivot.py @@ -3,7 +3,7 @@ import pandas.util.testing as tm -class TestPivotTable(tm.TestCase): +class TestPivotTable(object): def setup_method(self, method): self.dense = pd.DataFrame({'A': ['foo', 'bar', 'foo', 'bar', diff --git a/pandas/tests/sparse/test_series.py b/pandas/tests/sparse/test_series.py index b756b63523798..344bca54b180b 100644 --- a/pandas/tests/sparse/test_series.py +++ b/pandas/tests/sparse/test_series.py @@ -56,7 +56,7 @@ def _test_data2_zero(): return arr, index -class TestSparseSeries(tm.TestCase, SharedWithSparse): +class TestSparseSeries(SharedWithSparse): def setup_method(self, method): arr, index = _test_data1() @@ -934,7 +934,7 @@ def test_combine_first(self): tm.assert_sp_series_equal(result, expected) -class TestSparseHandlingMultiIndexes(tm.TestCase): +class TestSparseHandlingMultiIndexes(object): def setup_method(self, method): miindex = pd.MultiIndex.from_product( @@ -960,7 +960,7 @@ def test_round_trip_preserve_multiindex_names(self): check_names=True) -class TestSparseSeriesScipyInteraction(tm.TestCase): +class TestSparseSeriesScipyInteraction(object): # Issue 8048: add SparseSeries coo methods def setup_method(self, method): @@ -1310,7 +1310,7 @@ def _dense_series_compare(s, f): tm.assert_series_equal(result.to_dense(), dense_result) -class TestSparseSeriesAnalytics(tm.TestCase): +class TestSparseSeriesAnalytics(object): def setup_method(self, method): arr, index = _test_data1() diff --git a/pandas/tests/test_algos.py b/pandas/tests/test_algos.py index dda95426d8011..093730fb2478b 100644 --- a/pandas/tests/test_algos.py +++ b/pandas/tests/test_algos.py @@ -23,7 +23,7 @@ from pandas.util.testing import assert_almost_equal -class TestMatch(tm.TestCase): +class TestMatch(object): def test_ints(self): values = np.array([0, 2, 1]) @@ -59,7 +59,7 @@ def test_strings(self): tm.assert_series_equal(result, expected) -class TestSafeSort(tm.TestCase): +class TestSafeSort(object): def test_basic_sort(self): values = [3, 1, 2, 0, 4] @@ -146,7 +146,7 @@ def test_exceptions(self): algos.safe_sort(values=[0, 1, 2, 1], labels=[0, 1]) -class TestFactorize(tm.TestCase): +class TestFactorize(object): def test_basic(self): @@ -306,7 +306,7 @@ def test_uint64_factorize(self): tm.assert_numpy_array_equal(uniques, exp_uniques) -class TestUnique(tm.TestCase): +class TestUnique(object): def test_ints(self): arr = np.random.randint(0, 100, size=50) @@ -503,7 +503,7 @@ def test_order_of_appearance(self): tm.assert_categorical_equal(result, expected) -class TestIsin(tm.TestCase): +class TestIsin(object): def test_invalid(self): @@ -587,7 +587,7 @@ def test_large(self): tm.assert_numpy_array_equal(result, expected) -class TestValueCounts(tm.TestCase): +class TestValueCounts(object): def test_value_counts(self): np.random.seed(1234) @@ -779,7 +779,7 @@ def test_value_counts_uint64(self): tm.assert_series_equal(result, expected) -class TestDuplicated(tm.TestCase): +class TestDuplicated(object): def test_duplicated_with_nas(self): keys = np.array([0, 1, np.nan, 0, 2, np.nan], dtype=object) @@ -1014,7 +1014,7 @@ def test_group_var_constant(self): tm.assert_almost_equal(out[0, 0], 0.0) -class TestGroupVarFloat64(tm.TestCase, GroupVarTestMixin): +class TestGroupVarFloat64(GroupVarTestMixin): __test__ = True algo = libgroupby.group_var_float64 @@ -1037,7 +1037,7 @@ def test_group_var_large_inputs(self): tm.assert_almost_equal(out[0, 0], 1.0 / 12, check_less_precise=True) -class TestGroupVarFloat32(tm.TestCase, GroupVarTestMixin): +class TestGroupVarFloat32(GroupVarTestMixin): __test__ = True algo = libgroupby.group_var_float32 @@ -1045,7 +1045,7 @@ class TestGroupVarFloat32(tm.TestCase, GroupVarTestMixin): rtol = 1e-2 -class TestHashTable(tm.TestCase): +class TestHashTable(object): def test_lookup_nan(self): xs = np.array([2.718, 3.14, np.nan, -7, 5, 2, 3]) @@ -1116,7 +1116,7 @@ def test_unique_label_indices(): check_dtype=False) -class TestRank(tm.TestCase): +class TestRank(object): def test_scipy_compat(self): tm._skip_if_no_scipy() @@ -1184,7 +1184,7 @@ def test_arrmap(): assert (result.dtype == np.bool_) -class TestTseriesUtil(tm.TestCase): +class TestTseriesUtil(object): def test_combineFunc(self): pass @@ -1378,7 +1378,7 @@ def test_int64_add_overflow(): b_mask=np.array([False, True])) -class TestMode(tm.TestCase): +class TestMode(object): def test_no_mode(self): exp = Series([], dtype=np.float64) diff --git a/pandas/tests/test_base.py b/pandas/tests/test_base.py index dcc685ceef28e..85976b9fabd66 100644 --- a/pandas/tests/test_base.py +++ b/pandas/tests/test_base.py @@ -86,7 +86,7 @@ def check_result(self, result, expected, klass=None): assert result == expected -class TestPandasDelegate(tm.TestCase): +class TestPandasDelegate(object): class Delegator(object): _properties = ['foo'] @@ -152,7 +152,7 @@ def test_memory_usage(self): sys.getsizeof(delegate) -class Ops(tm.TestCase): +class Ops(object): def _allow_na_ops(self, obj): """Whether to skip test cases including NaN""" @@ -1008,7 +1008,7 @@ def test_numpy_transpose(self): np.transpose, obj, axes=1) -class TestNoNewAttributesMixin(tm.TestCase): +class TestNoNewAttributesMixin(object): def test_mixin(self): class T(NoNewAttributesMixin): diff --git a/pandas/tests/test_categorical.py b/pandas/tests/test_categorical.py index 2a53cf15278e0..03adf17f50300 100644 --- a/pandas/tests/test_categorical.py +++ b/pandas/tests/test_categorical.py @@ -28,7 +28,7 @@ from pandas.core.config import option_context -class TestCategorical(tm.TestCase): +class TestCategorical(object): def setup_method(self, method): self.factor = Categorical(['a', 'b', 'b', 'a', 'a', 'c', 'c', 'c'], @@ -1600,7 +1600,7 @@ def test_validate_inplace(self): cat.sort_values(inplace=value) -class TestCategoricalAsBlock(tm.TestCase): +class TestCategoricalAsBlock(object): def setup_method(self, method): self.factor = Categorical(['a', 'b', 'b', 'a', 'a', 'c', 'c', 'c']) @@ -4411,7 +4411,7 @@ def test_concat_categorical(self): tm.assert_frame_equal(res, exp) -class TestCategoricalSubclassing(tm.TestCase): +class TestCategoricalSubclassing(object): def test_constructor(self): sc = tm.SubclassedCategorical(['a', 'b', 'c']) diff --git a/pandas/tests/test_compat.py b/pandas/tests/test_compat.py index 5c56142687b5c..ff9d09c033164 100644 --- a/pandas/tests/test_compat.py +++ b/pandas/tests/test_compat.py @@ -6,10 +6,9 @@ from pandas.compat import (range, zip, map, filter, lrange, lzip, lmap, lfilter, builtins, iterkeys, itervalues, iteritems, next) -import pandas.util.testing as tm -class TestBuiltinIterators(tm.TestCase): +class TestBuiltinIterators(object): @classmethod def check_result(cls, actual, expected, lengths): diff --git a/pandas/tests/test_config.py b/pandas/tests/test_config.py index 79475b297f83c..f014b16976d39 100644 --- a/pandas/tests/test_config.py +++ b/pandas/tests/test_config.py @@ -1,13 +1,12 @@ # -*- coding: utf-8 -*- import pytest -import pandas.util.testing as tm import pandas as pd import warnings -class TestConfig(tm.TestCase): +class TestConfig(object): def __init__(self, *args): super(TestConfig, self).__init__(*args) diff --git a/pandas/tests/test_expressions.py b/pandas/tests/test_expressions.py index 79b057c0548a9..fae7bfa513dcd 100644 --- a/pandas/tests/test_expressions.py +++ b/pandas/tests/test_expressions.py @@ -56,7 +56,7 @@ @pytest.mark.skipif(not expr._USE_NUMEXPR, reason='not using numexpr') -class TestExpressions(tm.TestCase): +class TestExpressions(object): def setup_method(self, method): diff --git a/pandas/tests/test_internals.py b/pandas/tests/test_internals.py index 0f2a3ce1d1e94..0900d21b250ed 100644 --- a/pandas/tests/test_internals.py +++ b/pandas/tests/test_internals.py @@ -192,7 +192,7 @@ def create_mgr(descr, item_shape=None): [mgr_items] + [np.arange(n) for n in item_shape]) -class TestBlock(tm.TestCase): +class TestBlock(object): def setup_method(self, method): # self.fblock = get_float_ex() # a,c,e @@ -309,7 +309,7 @@ def test_split_block_at(self): # assert len(bs), 0) -class TestDatetimeBlock(tm.TestCase): +class TestDatetimeBlock(object): def test_try_coerce_arg(self): block = create_block('datetime', [0]) @@ -1072,7 +1072,7 @@ def assert_reindex_indexer_is_ok(mgr, axis, new_labels, indexer, # reindex_indexer(new_labels, indexer, axis) -class TestBlockPlacement(tm.TestCase): +class TestBlockPlacement(object): def test_slice_len(self): assert len(BlockPlacement(slice(0, 4))) == 4 diff --git a/pandas/tests/test_join.py b/pandas/tests/test_join.py index e9e7ffba7fe54..3fc13d23b53f7 100644 --- a/pandas/tests/test_join.py +++ b/pandas/tests/test_join.py @@ -8,7 +8,7 @@ from pandas.util.testing import assert_almost_equal -class TestIndexer(tm.TestCase): +class TestIndexer(object): def test_outer_join_indexer(self): typemap = [('int32', _join.outer_join_indexer_int32), diff --git a/pandas/tests/test_lib.py b/pandas/tests/test_lib.py index 0ac05bae624e5..df97095035952 100644 --- a/pandas/tests/test_lib.py +++ b/pandas/tests/test_lib.py @@ -8,7 +8,7 @@ import pandas.util.testing as tm -class TestMisc(tm.TestCase): +class TestMisc(object): def test_max_len_string_array(self): @@ -41,7 +41,7 @@ def test_fast_unique_multiple_list_gen_sort(self): tm.assert_numpy_array_equal(np.array(out), expected) -class TestIndexing(tm.TestCase): +class TestIndexing(object): def test_maybe_indices_to_slice_left_edge(self): target = np.arange(100) @@ -201,7 +201,7 @@ def test_get_reverse_indexer(self): assert np.array_equal(result, expected) -class TestNullObj(tm.TestCase): +class TestNullObj(object): _1d_methods = ['isnullobj', 'isnullobj_old'] _2d_methods = ['isnullobj2d', 'isnullobj2d_old'] diff --git a/pandas/tests/test_multilevel.py b/pandas/tests/test_multilevel.py index bfab10b7e63e7..ab28b8b43f359 100644 --- a/pandas/tests/test_multilevel.py +++ b/pandas/tests/test_multilevel.py @@ -56,7 +56,7 @@ def setup_method(self, method): self.ymd.index.set_names(['year', 'month', 'day'], inplace=True) -class TestMultiLevel(Base, tm.TestCase): +class TestMultiLevel(Base): def test_append(self): a, b = self.frame[:5], self.frame[5:] @@ -2352,7 +2352,7 @@ def test_iloc_mi(self): tm.assert_frame_equal(result, expected) -class TestSorted(Base, tm.TestCase): +class TestSorted(Base): """ everthing you wanted to test about sorting """ def test_sort_index_preserve_levels(self): diff --git a/pandas/tests/test_nanops.py b/pandas/tests/test_nanops.py index c5ecd75290fc6..6798e64b01d7e 100644 --- a/pandas/tests/test_nanops.py +++ b/pandas/tests/test_nanops.py @@ -16,7 +16,7 @@ use_bn = nanops._USE_BOTTLENECK -class TestnanopsDataFrame(tm.TestCase): +class TestnanopsDataFrame(object): def setup_method(self, method): np.random.seed(11235) @@ -742,7 +742,7 @@ def test__bn_ok_dtype(self): assert not nanops._bn_ok_dtype(self.arr_obj.dtype, 'test') -class TestEnsureNumeric(tm.TestCase): +class TestEnsureNumeric(object): def test_numeric_values(self): # Test integer @@ -782,7 +782,7 @@ def test_non_convertable_values(self): pytest.raises(TypeError, lambda: nanops._ensure_numeric([])) -class TestNanvarFixedValues(tm.TestCase): +class TestNanvarFixedValues(object): # xref GH10242 @@ -895,7 +895,7 @@ def prng(self): return np.random.RandomState(1234) -class TestNanskewFixedValues(tm.TestCase): +class TestNanskewFixedValues(object): # xref GH 11974 @@ -945,7 +945,7 @@ def prng(self): return np.random.RandomState(1234) -class TestNankurtFixedValues(tm.TestCase): +class TestNankurtFixedValues(object): # xref GH 11974 diff --git a/pandas/tests/test_panel.py b/pandas/tests/test_panel.py index 44e1db494c041..3243b69a25acd 100644 --- a/pandas/tests/test_panel.py +++ b/pandas/tests/test_panel.py @@ -901,7 +901,7 @@ def test_set_value(self): self.panel.set_value('a') -class TestPanel(tm.TestCase, PanelTests, CheckIndexing, SafeForLongAndSparse, +class TestPanel(PanelTests, CheckIndexing, SafeForLongAndSparse, SafeForSparse): @classmethod @@ -2430,7 +2430,7 @@ def test_all_any_unhandled(self): pytest.raises(NotImplementedError, self.panel.any, bool_only=True) -class TestLongPanel(tm.TestCase): +class TestLongPanel(object): """ LongPanel no longer exists, but... """ diff --git a/pandas/tests/test_panel4d.py b/pandas/tests/test_panel4d.py index 7d966422a7d79..96f02d63712fc 100644 --- a/pandas/tests/test_panel4d.py +++ b/pandas/tests/test_panel4d.py @@ -593,7 +593,7 @@ def test_set_value(self): assert is_float_dtype(res3['l4'].values) -class TestPanel4d(tm.TestCase, CheckIndexing, SafeForSparse, +class TestPanel4d(CheckIndexing, SafeForSparse, SafeForLongAndSparse): def setup_method(self, method): diff --git a/pandas/tests/test_panelnd.py b/pandas/tests/test_panelnd.py index 7861b98b0ddd9..c473e3c09cc74 100644 --- a/pandas/tests/test_panelnd.py +++ b/pandas/tests/test_panelnd.py @@ -9,7 +9,7 @@ import pandas.util.testing as tm -class TestPanelnd(tm.TestCase): +class TestPanelnd(object): def setup_method(self, method): pass diff --git a/pandas/tests/test_resample.py b/pandas/tests/test_resample.py index c6719790c9e35..9734431c8b012 100644 --- a/pandas/tests/test_resample.py +++ b/pandas/tests/test_resample.py @@ -50,7 +50,7 @@ def _simple_pts(start, end, freq='D'): return Series(np.random.randn(len(rng)), index=rng) -class TestResampleAPI(tm.TestCase): +class TestResampleAPI(object): def setup_method(self, method): dti = DatetimeIndex(start=datetime(2005, 1, 1), @@ -847,7 +847,7 @@ def test_resample_loffset_arg_type(self): assert_frame_equal(result_how, expected) -class TestDatetimeIndex(Base, tm.TestCase): +class TestDatetimeIndex(Base): _index_factory = lambda x: date_range def setup_method(self, method): @@ -2165,7 +2165,7 @@ def test_resample_datetime_values(self): tm.assert_series_equal(res, exp) -class TestPeriodIndex(Base, tm.TestCase): +class TestPeriodIndex(Base): _index_factory = lambda x: period_range def create_series(self): @@ -2773,7 +2773,7 @@ def test_evenly_divisible_with_no_extra_bins(self): assert_frame_equal(result, expected) -class TestTimedeltaIndex(Base, tm.TestCase): +class TestTimedeltaIndex(Base): _index_factory = lambda x: timedelta_range def create_series(self): @@ -2794,7 +2794,7 @@ def test_asfreq_bug(self): assert_frame_equal(result, expected) -class TestResamplerGrouper(tm.TestCase): +class TestResamplerGrouper(object): def setup_method(self, method): self.frame = DataFrame({'A': [1] * 20 + [2] * 12 + [3] * 8, @@ -2989,7 +2989,7 @@ def test_median_duplicate_columns(self): assert_frame_equal(result, expected) -class TestTimeGrouper(tm.TestCase): +class TestTimeGrouper(object): def setup_method(self, method): self.ts = Series(np.random.randn(1000), diff --git a/pandas/tests/test_sorting.py b/pandas/tests/test_sorting.py index c40cbcfdec883..e09270bcadf27 100644 --- a/pandas/tests/test_sorting.py +++ b/pandas/tests/test_sorting.py @@ -16,7 +16,7 @@ lexsort_indexer) -class TestSorting(tm.TestCase): +class TestSorting(object): @pytest.mark.slow def test_int64_overflow(self): @@ -191,7 +191,7 @@ def test_nargsort(self): tm.assert_numpy_array_equal(result, np.array(exp), check_dtype=False) -class TestMerge(tm.TestCase): +class TestMerge(object): @pytest.mark.slow def test_int64_overflow_issues(self): diff --git a/pandas/tests/test_strings.py b/pandas/tests/test_strings.py index 412a88e13bb23..f28a5926087ac 100644 --- a/pandas/tests/test_strings.py +++ b/pandas/tests/test_strings.py @@ -19,7 +19,7 @@ import pandas.core.strings as strings -class TestStringMethods(tm.TestCase): +class TestStringMethods(object): def test_api(self): diff --git a/pandas/tests/test_take.py b/pandas/tests/test_take.py index 617d268be8f67..7b97b0e975df3 100644 --- a/pandas/tests/test_take.py +++ b/pandas/tests/test_take.py @@ -9,7 +9,7 @@ from pandas._libs.tslib import iNaT -class TestTake(tm.TestCase): +class TestTake(object): # standard incompatible fill error fill_error = re.compile("Incompatible type for fill_value") diff --git a/pandas/tests/test_testing.py b/pandas/tests/test_testing.py index 2e84638533820..fe7c3b99987f5 100644 --- a/pandas/tests/test_testing.py +++ b/pandas/tests/test_testing.py @@ -12,7 +12,7 @@ from pandas.compat import is_platform_windows -class TestAssertAlmostEqual(tm.TestCase): +class TestAssertAlmostEqual(object): def _assert_almost_equal_both(self, a, b, **kwargs): assert_almost_equal(a, b, **kwargs) @@ -139,7 +139,7 @@ def test_assert_almost_equal_object(self): self._assert_almost_equal_both(a, b) -class TestUtilTesting(tm.TestCase): +class TestUtilTesting(object): def test_raise_with_traceback(self): with tm.assert_raises_regex(LookupError, "error_text"): @@ -157,7 +157,7 @@ def test_raise_with_traceback(self): raise_with_traceback(e, traceback) -class TestAssertNumpyArrayEqual(tm.TestCase): +class TestAssertNumpyArrayEqual(object): def test_numpy_array_equal_message(self): @@ -339,7 +339,7 @@ def test_assert_almost_equal_iterable_message(self): assert_almost_equal([1, 2], [1, 3]) -class TestAssertIndexEqual(tm.TestCase): +class TestAssertIndexEqual(object): def test_index_equal_message(self): @@ -486,7 +486,7 @@ def test_index_equal_metadata_message(self): assert_index_equal(idx1, idx2) -class TestAssertSeriesEqual(tm.TestCase): +class TestAssertSeriesEqual(object): def _assert_equal(self, x, y, **kwargs): assert_series_equal(x, y, **kwargs) @@ -580,7 +580,7 @@ def test_series_equal_message(self): check_less_precise=True) -class TestAssertFrameEqual(tm.TestCase): +class TestAssertFrameEqual(object): def _assert_equal(self, x, y, **kwargs): assert_frame_equal(x, y, **kwargs) @@ -679,7 +679,7 @@ def test_frame_equal_message(self): by_blocks=True) -class TestAssertCategoricalEqual(tm.TestCase): +class TestAssertCategoricalEqual(object): def test_categorical_equal_message(self): @@ -717,7 +717,7 @@ def test_categorical_equal_message(self): tm.assert_categorical_equal(a, b) -class TestRNGContext(tm.TestCase): +class TestRNGContext(object): def test_RNGContext(self): expected0 = 1.764052345967664 @@ -729,7 +729,7 @@ def test_RNGContext(self): assert np.random.randn() == expected0 -class TestLocale(tm.TestCase): +class TestLocale(object): def test_locale(self): if sys.platform == 'win32': diff --git a/pandas/tests/test_util.py b/pandas/tests/test_util.py index e9e04f76704f2..2d9ab78ceeb8a 100644 --- a/pandas/tests/test_util.py +++ b/pandas/tests/test_util.py @@ -20,7 +20,7 @@ LOCALE_OVERRIDE = os.environ.get('LOCALE_OVERRIDE', None) -class TestDecorators(tm.TestCase): +class TestDecorators(object): def setup_method(self, method): @deprecate_kwarg('old', 'new') @@ -89,7 +89,7 @@ def test_rands_array(): assert(len(arr[1, 1]) == 7) -class TestValidateArgs(tm.TestCase): +class TestValidateArgs(object): fname = 'func' def test_bad_min_fname_arg_count(self): @@ -159,7 +159,7 @@ def test_validation(self): validate_args(self.fname, (1, None), 2, compat_args) -class TestValidateKwargs(tm.TestCase): +class TestValidateKwargs(object): fname = 'func' def test_bad_kwarg(self): @@ -225,7 +225,7 @@ def test_validate_bool_kwarg(self): assert validate_bool_kwarg(value, name) == value -class TestValidateKwargsAndArgs(tm.TestCase): +class TestValidateKwargsAndArgs(object): fname = 'func' def test_invalid_total_length_max_length_one(self): @@ -322,7 +322,7 @@ def test_validation(self): compat_args) -class TestMove(tm.TestCase): +class TestMove(object): def test_cannot_create_instance_of_stolenbuffer(self): """Stolen buffers need to be created through the smart constructor @@ -407,11 +407,10 @@ def test_numpy_errstate_is_default(): assert np.geterr() == expected -class TestLocaleUtils(tm.TestCase): +class TestLocaleUtils(object): @classmethod def setup_class(cls): - super(TestLocaleUtils, cls).setup_class() cls.locales = tm.get_locales() if not cls.locales: @@ -421,7 +420,6 @@ def setup_class(cls): @classmethod def teardown_class(cls): - super(TestLocaleUtils, cls).teardown_class() del cls.locales def test_get_locales(self): diff --git a/pandas/tests/test_window.py b/pandas/tests/test_window.py index 5436f3c342019..634cd5fe2586b 100644 --- a/pandas/tests/test_window.py +++ b/pandas/tests/test_window.py @@ -30,7 +30,7 @@ def assert_equal(left, right): tm.assert_frame_equal(left, right) -class Base(tm.TestCase): +class Base(object): _nan_locs = np.arange(20, 40) _inf_locs = np.array([]) @@ -562,8 +562,8 @@ def test_deprecations(self): # gh-12373 : rolling functions error on float32 data # make sure rolling functions works for different dtypes # -# NOTE that these are yielded tests and so _create_data is -# explicity called, nor do these inherit from tm.TestCase +# NOTE that these are yielded tests and so _create_data +# is explicitly called. # # further note that we are only checking rolling for fully dtype # compliance (though both expanding and ewm inherit) @@ -3037,7 +3037,7 @@ def test_rolling_min_max_numeric_types(self): assert result.dtypes[0] == np.dtype("f8") -class TestGrouperGrouping(tm.TestCase): +class TestGrouperGrouping(object): def setup_method(self, method): self.series = Series(np.arange(10)) @@ -3182,7 +3182,7 @@ def test_expanding_apply(self): tm.assert_frame_equal(result, expected) -class TestRollingTS(tm.TestCase): +class TestRollingTS(object): # rolling time-series friendly # xref GH13327 diff --git a/pandas/tests/tools/test_numeric.py b/pandas/tests/tools/test_numeric.py index b298df4f4b5d8..f82ad97d7b70f 100644 --- a/pandas/tests/tools/test_numeric.py +++ b/pandas/tests/tools/test_numeric.py @@ -9,7 +9,7 @@ from numpy import iinfo -class TestToNumeric(tm.TestCase): +class TestToNumeric(object): def test_series(self): s = pd.Series(['1', '-3.14', '7']) diff --git a/pandas/tests/tseries/test_frequencies.py b/pandas/tests/tseries/test_frequencies.py index a78150e9cf728..2edca1bd4676b 100644 --- a/pandas/tests/tseries/test_frequencies.py +++ b/pandas/tests/tseries/test_frequencies.py @@ -19,7 +19,7 @@ from pandas import Timedelta -class TestToOffset(tm.TestCase): +class TestToOffset(object): def test_to_offset_multiple(self): freqstr = '2h30min' @@ -342,7 +342,7 @@ def _assert_depr(freq, expected, aliases): assert (frequencies._period_str_to_code('NS') == 12000) -class TestFrequencyCode(tm.TestCase): +class TestFrequencyCode(object): def test_freq_code(self): assert frequencies.get_freq('A') == 1000 @@ -493,7 +493,7 @@ def test_get_freq_code(self): _dti = DatetimeIndex -class TestFrequencyInference(tm.TestCase): +class TestFrequencyInference(object): def test_raise_if_period_index(self): index = PeriodIndex(start="1/1/1990", periods=20, freq="M") diff --git a/pandas/tests/tseries/test_holiday.py b/pandas/tests/tseries/test_holiday.py index 8ea4140bb85a7..59a2a225ab5f8 100644 --- a/pandas/tests/tseries/test_holiday.py +++ b/pandas/tests/tseries/test_holiday.py @@ -19,7 +19,7 @@ from pytz import utc -class TestCalendar(tm.TestCase): +class TestCalendar(object): def setup_method(self, method): self.holiday_list = [ @@ -85,7 +85,7 @@ def test_rule_from_name(self): assert USFedCal.rule_from_name('Thanksgiving') == USThanksgivingDay -class TestHoliday(tm.TestCase): +class TestHoliday(object): def setup_method(self, method): self.start_date = datetime(2011, 1, 1) @@ -284,7 +284,7 @@ def test_factory(self): assert len(class_3.rules) == 2 -class TestObservanceRules(tm.TestCase): +class TestObservanceRules(object): def setup_method(self, method): self.we = datetime(2014, 4, 9) @@ -342,7 +342,7 @@ def test_after_nearest_workday(self): assert after_nearest_workday(self.fr) == self.mo -class TestFederalHolidayCalendar(tm.TestCase): +class TestFederalHolidayCalendar(object): def test_no_mlk_before_1984(self): # see gh-10278 @@ -375,7 +375,7 @@ class MemorialDay(AbstractHolidayCalendar): datetime(1979, 5, 28, 0, 0)] -class TestHolidayConflictingArguments(tm.TestCase): +class TestHolidayConflictingArguments(object): def test_both_offset_observance_raises(self): # see gh-10217 diff --git a/pandas/tests/tseries/test_offsets.py b/pandas/tests/tseries/test_offsets.py index b6cd5e7958342..09de064c15183 100644 --- a/pandas/tests/tseries/test_offsets.py +++ b/pandas/tests/tseries/test_offsets.py @@ -97,7 +97,7 @@ def test_to_m8(): ##### -class Base(tm.TestCase): +class Base(object): _offset = None _offset_types = [getattr(offsets, o) for o in offsets.__all__] @@ -4334,7 +4334,7 @@ def test_Easter(): assertEq(-Easter(2), datetime(2010, 4, 4), datetime(2008, 3, 23)) -class TestTicks(tm.TestCase): +class TestTicks(object): ticks = [Hour, Minute, Second, Milli, Micro, Nano] @@ -4491,7 +4491,7 @@ def test_compare_ticks(self): assert kls(3) != kls(4) -class TestOffsetNames(tm.TestCase): +class TestOffsetNames(object): def test_get_offset_name(self): assert BDay().freqstr == 'B' @@ -4547,7 +4547,7 @@ def test_get_offset_legacy(): get_offset(name) -class TestParseTimeString(tm.TestCase): +class TestParseTimeString(object): def test_parse_time_string(self): (date, parsed, reso) = parse_time_string('4Q1984') @@ -4610,7 +4610,7 @@ def test_quarterly_dont_normalize(): assert (result.time() == date.time()) -class TestOffsetAliases(tm.TestCase): +class TestOffsetAliases(object): def setup_method(self, method): _offset_map.clear() @@ -4691,7 +4691,7 @@ def get_all_subclasses(cls): return ret -class TestCaching(tm.TestCase): +class TestCaching(object): # as of GH 6479 (in 0.14.0), offset caching is turned off # as of v0.12.0 only BusinessMonth/Quarter were actually caching @@ -4746,7 +4746,7 @@ def test_week_of_month_index_creation(self): assert inst2 not in _daterange_cache -class TestReprNames(tm.TestCase): +class TestReprNames(object): def test_str_for_named_is_name(self): # look at all the amazing combinations! @@ -4771,7 +4771,7 @@ def get_utc_offset_hours(ts): return (o.days * 24 * 3600 + o.seconds) / 3600.0 -class TestDST(tm.TestCase): +class TestDST(object): """ test DateOffset additions over Daylight Savings Time """ diff --git a/pandas/tests/tseries/test_timezones.py b/pandas/tests/tseries/test_timezones.py index 74220aa5cd183..97c54922d36e9 100644 --- a/pandas/tests/tseries/test_timezones.py +++ b/pandas/tests/tseries/test_timezones.py @@ -50,7 +50,7 @@ def dst(self, dt): fixed_off_no_name = FixedOffset(-330, None) -class TestTimeZoneSupportPytz(tm.TestCase): +class TestTimeZoneSupportPytz(object): def setup_method(self, method): tm._skip_if_no_pytz() @@ -1178,7 +1178,7 @@ def test_tz_convert_tzlocal(self): tm.assert_numpy_array_equal(dti2.asi8, dti.asi8) -class TestTimeZoneCacheKey(tm.TestCase): +class TestTimeZoneCacheKey(object): def test_cache_keys_are_distinct_for_pytz_vs_dateutil(self): tzs = pytz.common_timezones @@ -1194,7 +1194,7 @@ def test_cache_keys_are_distinct_for_pytz_vs_dateutil(self): assert tslib._p_tz_cache_key(tz_p) != tslib._p_tz_cache_key(tz_d) -class TestTimeZones(tm.TestCase): +class TestTimeZones(object): timezones = ['UTC', 'Asia/Tokyo', 'US/Eastern', 'dateutil/US/Pacific'] def setup_method(self, method): @@ -1719,7 +1719,7 @@ def test_nat(self): tm.assert_index_equal(idx, DatetimeIndex(expected, tz='US/Eastern')) -class TestTslib(tm.TestCase): +class TestTslib(object): def test_tslib_tz_convert(self): def compare_utc_to_local(tz_didx, utc_didx): diff --git a/pandas/util/testing.py b/pandas/util/testing.py index 354e11ce0133a..0d70d51032b3d 100644 --- a/pandas/util/testing.py +++ b/pandas/util/testing.py @@ -85,20 +85,6 @@ def reset_testing_mode(): set_testing_mode() -class TestCase(object): - """ - Base class for all test case classes. - """ - - @classmethod - def setup_class(cls): - pd.set_option('chained_assignment', 'raise') - - @classmethod - def teardown_class(cls): - pass - - def reset_display_options(): """ Reset the display options for printing and representing objects.