From 42587dd265232e6642e2fd009ccbffe9f4469700 Mon Sep 17 00:00:00 2001 From: gfyoung Date: Sat, 15 Apr 2017 22:00:30 -0400 Subject: [PATCH 1/4] MAINT: Move reset_display_options outside of TestCase --- pandas/tests/frame/test_repr_info.py | 2 +- pandas/tests/indexes/test_multi.py | 2 +- pandas/tests/io/formats/test_eng_formatting.py | 4 ++-- pandas/tests/io/formats/test_format.py | 16 ++++++++-------- pandas/util/decorators.py | 2 +- pandas/util/testing.py | 12 ++++++++---- 6 files changed, 21 insertions(+), 17 deletions(-) diff --git a/pandas/tests/frame/test_repr_info.py b/pandas/tests/frame/test_repr_info.py index 740a24f38c316..be55efac2992b 100644 --- a/pandas/tests/frame/test_repr_info.py +++ b/pandas/tests/frame/test_repr_info.py @@ -118,7 +118,7 @@ def test_repr_unsortable(self): fmt.set_option('display.max_rows', 1000, 'display.max_columns', 1000) repr(self.frame) - self.reset_display_options() + tm.reset_display_options() warnings.filters = warn_filters diff --git a/pandas/tests/indexes/test_multi.py b/pandas/tests/indexes/test_multi.py index e93319a30d5d8..281841c1f6c67 100644 --- a/pandas/tests/indexes/test_multi.py +++ b/pandas/tests/indexes/test_multi.py @@ -1392,7 +1392,7 @@ def test_format_sparse_config(self): result = self.index.format() self.assertEqual(result[1], 'foo two') - self.reset_display_options() + tm.reset_display_options() warnings.filters = warn_filters diff --git a/pandas/tests/io/formats/test_eng_formatting.py b/pandas/tests/io/formats/test_eng_formatting.py index 225a4921961cf..8eb4ed576fff1 100644 --- a/pandas/tests/io/formats/test_eng_formatting.py +++ b/pandas/tests/io/formats/test_eng_formatting.py @@ -38,7 +38,7 @@ def test_eng_float_formatter(self): '3 1E+06') self.assertEqual(result, expected) - self.reset_display_options() + tm.reset_display_options() def compare(self, formatter, input, output): formatted_input = formatter(input) @@ -185,7 +185,7 @@ def test_nan(self): fmt.set_eng_float_format(accuracy=1) result = pt.to_string() self.assertTrue('NaN' in result) - self.reset_display_options() + tm.reset_display_options() def test_inf(self): # Issue #11981 diff --git a/pandas/tests/io/formats/test_format.py b/pandas/tests/io/formats/test_format.py index 7c74f82741e8c..aaddca8f9f1e5 100644 --- a/pandas/tests/io/formats/test_format.py +++ b/pandas/tests/io/formats/test_format.py @@ -138,7 +138,7 @@ def test_eng_float_formatter(self): fmt.set_eng_float_format(accuracy=0) repr(self.frame) - self.reset_display_options() + tm.reset_display_options() def test_show_null_counts(self): @@ -1197,7 +1197,7 @@ def test_to_string_line_width_no_index(self): self.assertEqual(df_s, expected) def test_to_string_float_formatting(self): - self.reset_display_options() + tm.reset_display_options() fmt.set_option('display.precision', 5, 'display.column_space', 12, 'display.notebook_repr_html', False) @@ -1226,7 +1226,7 @@ def test_to_string_float_formatting(self): expected = (' x\n' '0 3234.000\n' '1 0.253') self.assertEqual(df_s, expected) - self.reset_display_options() + tm.reset_display_options() self.assertEqual(get_option("display.precision"), 6) df = DataFrame({'x': [1e9, 0.2512]}) @@ -1310,14 +1310,14 @@ def test_to_string_index_formatter(self): self.assertEqual(rs, xp) def test_to_string_left_justify_cols(self): - self.reset_display_options() + tm.reset_display_options() df = DataFrame({'x': [3234, 0.253]}) df_s = df.to_string(justify='left') expected = (' x \n' '0 3234.000\n' '1 0.253') self.assertEqual(df_s, expected) def test_to_string_format_na(self): - self.reset_display_options() + tm.reset_display_options() df = DataFrame({'A': [np.nan, -1, -2.1234, 3, 4], 'B': [np.nan, 'foo', 'foooo', 'fooooo', 'bar']}) result = df.to_string() @@ -1380,7 +1380,7 @@ def test_repr_html(self): fmt.set_option('display.notebook_repr_html', False) self.frame._repr_html_() - self.reset_display_options() + tm.reset_display_options() df = DataFrame([[1, 2], [3, 4]]) fmt.set_option('display.show_dimensions', True) @@ -1388,7 +1388,7 @@ def test_repr_html(self): fmt.set_option('display.show_dimensions', False) self.assertFalse('2 rows' in df._repr_html_()) - self.reset_display_options() + tm.reset_display_options() def test_repr_html_wide(self): max_cols = get_option('display.max_columns') @@ -1552,7 +1552,7 @@ def get_ipython(): repstr = self.frame._repr_html_() self.assertIn('class', repstr) # info fallback - self.reset_display_options() + tm.reset_display_options() def test_pprint_pathological_object(self): """ diff --git a/pandas/util/decorators.py b/pandas/util/decorators.py index ca588e2a0432e..772b206f82e69 100644 --- a/pandas/util/decorators.py +++ b/pandas/util/decorators.py @@ -24,7 +24,7 @@ def deprecate_kwarg(old_arg_name, new_arg_name, mapping=None, stacklevel=2): old_arg_name : str Name of argument in function to deprecate new_arg_name : str - Name of prefered argument in function + Name of preferred argument in function mapping : dict or callable If mapping is present, use it to translate old arguments to new arguments. A callable must do its own value checking; diff --git a/pandas/util/testing.py b/pandas/util/testing.py index d1f88c7041e05..a63b7af905e9f 100644 --- a/pandas/util/testing.py +++ b/pandas/util/testing.py @@ -92,10 +92,6 @@ def setUpClass(cls): def tearDownClass(cls): pass - def reset_display_options(self): - # reset the display options - pd.reset_option('^display.', silent=True) - def round_trip_pickle(self, obj, path=None): return round_trip_pickle(obj, path=path) @@ -121,6 +117,14 @@ def assertNotAlmostEquals(self, *args, **kwargs): self.assertNotAlmostEqual)(*args, **kwargs) +def reset_display_options(): + """ + Reset the display options for printing and representing objects. + """ + + pd.reset_option('^display.', silent=True) + + def round_trip_pickle(obj, path=None): if path is None: path = u('__%s__.pickle' % rands(10)) From 61e10e3ea25455057432f2727df63d3501f8b6bb Mon Sep 17 00:00:00 2001 From: gfyoung Date: Sat, 15 Apr 2017 23:02:55 -0400 Subject: [PATCH 2/4] MAINT: Move round_trip_pickle outside of TestCase --- pandas/tests/core/dtypes/test_dtypes.py | 2 +- pandas/tests/core/sparse/test_array.py | 2 +- pandas/tests/core/sparse/test_frame.py | 2 +- pandas/tests/core/sparse/test_series.py | 2 +- pandas/tests/frame/test_block_internals.py | 6 +++--- pandas/tests/frame/test_subclass.py | 2 +- pandas/tests/indexes/common.py | 2 +- .../tests/indexes/datetimes/test_datetime.py | 2 +- pandas/tests/indexes/datetimes/test_ops.py | 4 ++-- pandas/tests/indexes/period/test_period.py | 4 ++-- pandas/tests/indexes/test_multi.py | 2 +- .../indexes/timedeltas/test_timedelta.py | 2 +- pandas/tests/scalar/test_period.py | 2 +- pandas/tests/scalar/test_timedelta.py | 2 +- pandas/tests/series/test_io.py | 2 +- pandas/tests/series/test_timeseries.py | 6 +++--- pandas/tests/test_multilevel.py | 2 +- pandas/tests/test_panel.py | 2 +- pandas/tests/tseries/test_offsets.py | 4 ++-- pandas/util/testing.py | 19 ++++++++++++++++--- 20 files changed, 42 insertions(+), 29 deletions(-) diff --git a/pandas/tests/core/dtypes/test_dtypes.py b/pandas/tests/core/dtypes/test_dtypes.py index ec9876df14e3b..46569fecf553f 100644 --- a/pandas/tests/core/dtypes/test_dtypes.py +++ b/pandas/tests/core/dtypes/test_dtypes.py @@ -40,7 +40,7 @@ def f(): self.assertNotEqual(np.str_, self.dtype) def test_pickle(self): - result = self.round_trip_pickle(self.dtype) + result = tm.round_trip_pickle(self.dtype) self.assertEqual(result, self.dtype) diff --git a/pandas/tests/core/sparse/test_array.py b/pandas/tests/core/sparse/test_array.py index b7b664e7bfb8a..9a1346430175d 100644 --- a/pandas/tests/core/sparse/test_array.py +++ b/pandas/tests/core/sparse/test_array.py @@ -562,7 +562,7 @@ def _check_inplace_op(op): def test_pickle(self): def _check_roundtrip(obj): - unpickled = self.round_trip_pickle(obj) + unpickled = tm.round_trip_pickle(obj) tm.assert_sp_array_equal(unpickled, obj) _check_roundtrip(self.arr) diff --git a/pandas/tests/core/sparse/test_frame.py b/pandas/tests/core/sparse/test_frame.py index adb813a27e7e9..8c85d01807944 100644 --- a/pandas/tests/core/sparse/test_frame.py +++ b/pandas/tests/core/sparse/test_frame.py @@ -278,7 +278,7 @@ def test_array_interface(self): def test_pickle(self): def _test_roundtrip(frame, orig): - result = self.round_trip_pickle(frame) + result = tm.round_trip_pickle(frame) tm.assert_sp_frame_equal(frame, result) tm.assert_frame_equal(result.to_dense(), orig, check_dtype=False) diff --git a/pandas/tests/core/sparse/test_series.py b/pandas/tests/core/sparse/test_series.py index 0b71dffe1782b..52032b618cd1d 100644 --- a/pandas/tests/core/sparse/test_series.py +++ b/pandas/tests/core/sparse/test_series.py @@ -390,7 +390,7 @@ def test_to_frame(self): def test_pickle(self): def _test_roundtrip(series): - unpickled = self.round_trip_pickle(series) + unpickled = tm.round_trip_pickle(series) tm.assert_sp_series_equal(series, unpickled) tm.assert_series_equal(series.to_dense(), unpickled.to_dense()) diff --git a/pandas/tests/frame/test_block_internals.py b/pandas/tests/frame/test_block_internals.py index accd3ddeb03d7..bfe1b0aae90b1 100644 --- a/pandas/tests/frame/test_block_internals.py +++ b/pandas/tests/frame/test_block_internals.py @@ -350,18 +350,18 @@ def test_copy(self): self.assertIsNot(copy._data, self.mixed_frame._data) def test_pickle(self): - unpickled = self.round_trip_pickle(self.mixed_frame) + unpickled = tm.round_trip_pickle(self.mixed_frame) assert_frame_equal(self.mixed_frame, unpickled) # buglet self.mixed_frame._data.ndim # empty - unpickled = self.round_trip_pickle(self.empty) + unpickled = tm.round_trip_pickle(self.empty) repr(unpickled) # tz frame - unpickled = self.round_trip_pickle(self.tzframe) + unpickled = tm.round_trip_pickle(self.tzframe) assert_frame_equal(self.tzframe, unpickled) def test_consolidate_datetime64(self): diff --git a/pandas/tests/frame/test_subclass.py b/pandas/tests/frame/test_subclass.py index 7444490d18373..ad414dce91b35 100644 --- a/pandas/tests/frame/test_subclass.py +++ b/pandas/tests/frame/test_subclass.py @@ -85,7 +85,7 @@ def test_dataframe_metadata(self): self.assertEqual(df.iloc[0:1, :].testattr, 'XXX') # GH10553 - unpickled = self.round_trip_pickle(df) + unpickled = tm.round_trip_pickle(df) tm.assert_frame_equal(df, unpickled) self.assertEqual(df._metadata, unpickled._metadata) self.assertEqual(df.testattr, unpickled.testattr) diff --git a/pandas/tests/indexes/common.py b/pandas/tests/indexes/common.py index 25214e6b170b5..15eceac6b00c9 100644 --- a/pandas/tests/indexes/common.py +++ b/pandas/tests/indexes/common.py @@ -28,7 +28,7 @@ def setup_indices(self): setattr(self, name, idx) def verify_pickle(self, index): - unpickled = self.round_trip_pickle(index) + unpickled = tm.round_trip_pickle(index) self.assertTrue(index.equals(unpickled)) def test_pickle_compat_construction(self): diff --git a/pandas/tests/indexes/datetimes/test_datetime.py b/pandas/tests/indexes/datetimes/test_datetime.py index 78c37f773547a..feedde77ebdd2 100644 --- a/pandas/tests/indexes/datetimes/test_datetime.py +++ b/pandas/tests/indexes/datetimes/test_datetime.py @@ -106,7 +106,7 @@ def test_roundtrip_pickle_with_tz(self): # GH 8367 # round-trip of timezone index = date_range('20130101', periods=3, tz='US/Eastern', name='foo') - unpickled = self.round_trip_pickle(index) + unpickled = tm.round_trip_pickle(index) self.assert_index_equal(index, unpickled) def test_reindex_preserves_tz_if_target_is_empty_list_or_array(self): diff --git a/pandas/tests/indexes/datetimes/test_ops.py b/pandas/tests/indexes/datetimes/test_ops.py index 4be9999982f12..6e6d6bf190291 100644 --- a/pandas/tests/indexes/datetimes/test_ops.py +++ b/pandas/tests/indexes/datetimes/test_ops.py @@ -1121,7 +1121,7 @@ def test_comparison(self): self.assertFalse(comp[9]) def test_pickle_unpickle(self): - unpickled = self.round_trip_pickle(self.rng) + unpickled = tm.round_trip_pickle(self.rng) self.assertIsNotNone(unpickled.offset) def test_copy(self): @@ -1272,7 +1272,7 @@ def test_shift(self): self.assertEqual(shifted[0], rng[0] + CDay()) def test_pickle_unpickle(self): - unpickled = self.round_trip_pickle(self.rng) + unpickled = tm.round_trip_pickle(self.rng) self.assertIsNotNone(unpickled.offset) def test_summary(self): diff --git a/pandas/tests/indexes/period/test_period.py b/pandas/tests/indexes/period/test_period.py index 6639fcd985ac4..fcbb1c10426bc 100644 --- a/pandas/tests/indexes/period/test_period.py +++ b/pandas/tests/indexes/period/test_period.py @@ -58,7 +58,7 @@ def test_pickle_compat_construction(self): def test_pickle_round_trip(self): for freq in ['D', 'M', 'Y']: idx = PeriodIndex(['2016-05-16', 'NaT', NaT, np.NaN], freq='D') - result = self.round_trip_pickle(idx) + result = tm.round_trip_pickle(idx) tm.assert_index_equal(result, idx) def test_get_loc(self): @@ -761,7 +761,7 @@ def test_append_concat(self): def test_pickle_freq(self): # GH2891 prng = period_range('1/1/2011', '1/1/2012', freq='M') - new_prng = self.round_trip_pickle(prng) + new_prng = tm.round_trip_pickle(prng) self.assertEqual(new_prng.freq, offsets.MonthEnd()) self.assertEqual(new_prng.freqstr, 'M') diff --git a/pandas/tests/indexes/test_multi.py b/pandas/tests/indexes/test_multi.py index 281841c1f6c67..b33a317eefd44 100644 --- a/pandas/tests/indexes/test_multi.py +++ b/pandas/tests/indexes/test_multi.py @@ -1044,7 +1044,7 @@ def test_roundtrip_pickle_with_tz(self): [[1, 2], ['a', 'b'], date_range('20130101', periods=3, tz='US/Eastern') ], names=['one', 'two', 'three']) - unpickled = self.round_trip_pickle(index) + unpickled = tm.round_trip_pickle(index) self.assertTrue(index.equal_levels(unpickled)) def test_from_tuples_index_values(self): diff --git a/pandas/tests/indexes/timedeltas/test_timedelta.py b/pandas/tests/indexes/timedeltas/test_timedelta.py index 3abc2d8422fd3..f434938a6e803 100644 --- a/pandas/tests/indexes/timedeltas/test_timedelta.py +++ b/pandas/tests/indexes/timedeltas/test_timedelta.py @@ -454,7 +454,7 @@ def test_pass_TimedeltaIndex_to_index(self): def test_pickle(self): rng = timedelta_range('1 days', periods=10) - rng_p = self.round_trip_pickle(rng) + rng_p = tm.round_trip_pickle(rng) tm.assert_index_equal(rng, rng_p) def test_hash_error(self): diff --git a/pandas/tests/scalar/test_period.py b/pandas/tests/scalar/test_period.py index 7a15600d6041e..98af0028469bf 100644 --- a/pandas/tests/scalar/test_period.py +++ b/pandas/tests/scalar/test_period.py @@ -909,7 +909,7 @@ def test_multiples(self): def test_round_trip(self): p = Period('2000Q1') - new_p = self.round_trip_pickle(p) + new_p = tm.round_trip_pickle(p) self.assertEqual(new_p, p) diff --git a/pandas/tests/scalar/test_timedelta.py b/pandas/tests/scalar/test_timedelta.py index c22d1d2329fba..abdbf29008b7e 100644 --- a/pandas/tests/scalar/test_timedelta.py +++ b/pandas/tests/scalar/test_timedelta.py @@ -559,7 +559,7 @@ def test_overflow(self): def test_pickle(self): v = Timedelta('1 days 10:11:12.0123456') - v_p = self.round_trip_pickle(v) + v_p = tm.round_trip_pickle(v) self.assertEqual(v, v_p) def test_timedelta_hash_equality(self): diff --git a/pandas/tests/series/test_io.py b/pandas/tests/series/test_io.py index d514fbfc142f0..a86ca880e75e4 100644 --- a/pandas/tests/series/test_io.py +++ b/pandas/tests/series/test_io.py @@ -134,7 +134,7 @@ def test_timeseries_periodindex(self): from pandas import period_range prng = period_range('1/1/2011', '1/1/2012', freq='M') ts = Series(np.random.randn(len(prng)), prng) - new_ts = self.round_trip_pickle(ts) + new_ts = tm.round_trip_pickle(ts) self.assertEqual(new_ts.index.freq, 'M') def test_pickle_preserve_name(self): diff --git a/pandas/tests/series/test_timeseries.py b/pandas/tests/series/test_timeseries.py index ce7d5a573bfab..5a88b5bf98699 100644 --- a/pandas/tests/series/test_timeseries.py +++ b/pandas/tests/series/test_timeseries.py @@ -827,11 +827,11 @@ def test_asfreq_resample_set_correct_freq(self): def test_pickle(self): # GH4606 - p = self.round_trip_pickle(NaT) + p = tm.round_trip_pickle(NaT) self.assertTrue(p is NaT) idx = pd.to_datetime(['2013-01-01', NaT, '2014-01-06']) - idx_p = self.round_trip_pickle(idx) + idx_p = tm.round_trip_pickle(idx) self.assertTrue(idx_p[0] == idx[0]) self.assertTrue(idx_p[1] is NaT) self.assertTrue(idx_p[2] == idx[2]) @@ -839,7 +839,7 @@ def test_pickle(self): # GH11002 # don't infer freq idx = date_range('1750-1-1', '2050-1-1', freq='7D') - idx_p = self.round_trip_pickle(idx) + idx_p = tm.round_trip_pickle(idx) tm.assert_index_equal(idx, idx_p) def test_setops_preserve_freq(self): diff --git a/pandas/tests/test_multilevel.py b/pandas/tests/test_multilevel.py index 648a3b98b245a..24bbf895508d7 100755 --- a/pandas/tests/test_multilevel.py +++ b/pandas/tests/test_multilevel.py @@ -179,7 +179,7 @@ def _check_op(opname): def test_pickle(self): def _test_roundtrip(frame): - unpickled = self.round_trip_pickle(frame) + unpickled = tm.round_trip_pickle(frame) tm.assert_frame_equal(frame, unpickled) _test_roundtrip(self.frame) diff --git a/pandas/tests/test_panel.py b/pandas/tests/test_panel.py index 60173dda57e04..4e9805ca9d5a6 100644 --- a/pandas/tests/test_panel.py +++ b/pandas/tests/test_panel.py @@ -43,7 +43,7 @@ class PanelTests(object): def test_pickle(self): with catch_warnings(record=True): - unpickled = self.round_trip_pickle(self.panel) + unpickled = tm.round_trip_pickle(self.panel) assert_frame_equal(unpickled['ItemA'], self.panel['ItemA']) def test_rank(self): diff --git a/pandas/tests/tseries/test_offsets.py b/pandas/tests/tseries/test_offsets.py index f644c353982f6..2dc2485550bc5 100644 --- a/pandas/tests/tseries/test_offsets.py +++ b/pandas/tests/tseries/test_offsets.py @@ -1906,7 +1906,7 @@ def test_calendar(self): def test_roundtrip_pickle(self): def _check_roundtrip(obj): - unpickled = self.round_trip_pickle(obj) + unpickled = tm.round_trip_pickle(obj) self.assertEqual(unpickled, obj) _check_roundtrip(self.offset) @@ -1967,7 +1967,7 @@ def test_offsets_compare_equal(self): def test_roundtrip_pickle(self): def _check_roundtrip(obj): - unpickled = self.round_trip_pickle(obj) + unpickled = tm.round_trip_pickle(obj) self.assertEqual(unpickled, obj) _check_roundtrip(self._object()) diff --git a/pandas/util/testing.py b/pandas/util/testing.py index a63b7af905e9f..f715e1e92239d 100644 --- a/pandas/util/testing.py +++ b/pandas/util/testing.py @@ -92,9 +92,6 @@ def setUpClass(cls): def tearDownClass(cls): pass - def round_trip_pickle(self, obj, path=None): - return round_trip_pickle(obj, path=path) - # https://docs.python.org/3/library/unittest.html#deprecated-aliases def assertEquals(self, *args, **kwargs): return deprecate('assertEquals', @@ -126,6 +123,22 @@ def reset_display_options(): def round_trip_pickle(obj, path=None): + """ + Pickle an object and then read it again. + + Parameters + ---------- + obj : pandas object + The object to pickle and then re-read. + path : str, default None + The path where the pickled object is written and then read. + + Returns + ------- + round_trip_pickled_object : pandas object + The original object that was pickled and then re-read. + """ + if path is None: path = u('__%s__.pickle' % rands(10)) with ensure_clean(path) as path: From a0baf222d378e8d6b8adec8bc7fd71fb70cc6026 Mon Sep 17 00:00:00 2001 From: gfyoung Date: Sat, 15 Apr 2017 23:31:34 -0400 Subject: [PATCH 3/4] MAINT: Remove all deprecated aliases from TestCase --- pandas/tests/test_testing.py | 20 -------------------- pandas/util/testing.py | 21 --------------------- 2 files changed, 41 deletions(-) diff --git a/pandas/tests/test_testing.py b/pandas/tests/test_testing.py index e5cb953cb35a5..fe4149583182d 100644 --- a/pandas/tests/test_testing.py +++ b/pandas/tests/test_testing.py @@ -746,26 +746,6 @@ def test_RNGContext(self): self.assertEqual(np.random.randn(), expected0) -class TestDeprecatedTests(tm.TestCase): - - def test_warning(self): - - with tm.assert_produces_warning(FutureWarning, check_stacklevel=False): - self.assertEquals(1, 1) - - with tm.assert_produces_warning(FutureWarning, check_stacklevel=False): - self.assertNotEquals(1, 2) - - with tm.assert_produces_warning(FutureWarning, check_stacklevel=False): - self.assert_(True) - - with tm.assert_produces_warning(FutureWarning, check_stacklevel=False): - self.assertAlmostEquals(1.0, 1.0000000001) - - with tm.assert_produces_warning(FutureWarning, check_stacklevel=False): - self.assertNotAlmostEquals(1, 2) - - class TestLocale(tm.TestCase): def test_locale(self): diff --git a/pandas/util/testing.py b/pandas/util/testing.py index f715e1e92239d..556375514a2cd 100644 --- a/pandas/util/testing.py +++ b/pandas/util/testing.py @@ -92,27 +92,6 @@ def setUpClass(cls): def tearDownClass(cls): pass - # https://docs.python.org/3/library/unittest.html#deprecated-aliases - def assertEquals(self, *args, **kwargs): - return deprecate('assertEquals', - self.assertEqual)(*args, **kwargs) - - def assertNotEquals(self, *args, **kwargs): - return deprecate('assertNotEquals', - self.assertNotEqual)(*args, **kwargs) - - def assert_(self, *args, **kwargs): - return deprecate('assert_', - self.assertTrue)(*args, **kwargs) - - def assertAlmostEquals(self, *args, **kwargs): - return deprecate('assertAlmostEquals', - self.assertAlmostEqual)(*args, **kwargs) - - def assertNotAlmostEquals(self, *args, **kwargs): - return deprecate('assertNotAlmostEquals', - self.assertNotAlmostEqual)(*args, **kwargs) - def reset_display_options(): """ From b2b680209426c9df8b3226f312d3d5c25281124f Mon Sep 17 00:00:00 2001 From: gfyoung Date: Sat, 15 Apr 2017 23:43:11 -0400 Subject: [PATCH 4/4] DOC: Add doc explaining TestCase usage under pytest --- pandas/util/testing.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pandas/util/testing.py b/pandas/util/testing.py index 556375514a2cd..00d3feb6b1c2b 100644 --- a/pandas/util/testing.py +++ b/pandas/util/testing.py @@ -50,7 +50,6 @@ Index, MultiIndex, Series, DataFrame, Panel, Panel4D) -from pandas.util.decorators import deprecate from pandas.util import libtesting from pandas.io.common import urlopen slow = pytest.mark.slow @@ -83,6 +82,14 @@ def reset_testing_mode(): class TestCase(unittest.TestCase): + """ + The test case class that we originally used when using the + nosetests framework. Under the new pytest framework, we are + moving away from this class. + + Do not create new test classes derived from this one. Rather, + they should inherit from object directly. + """ @classmethod def setUpClass(cls):