From db922198626ea1860263fb91c92c5d46b7ef9b43 Mon Sep 17 00:00:00 2001 From: tp Date: Fri, 18 May 2018 20:01:04 +0100 Subject: [PATCH 1/2] add to index attributes deprecations --- pandas/core/accessor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/core/accessor.py b/pandas/core/accessor.py index c638b9e4ea117..7a853d575aa69 100644 --- a/pandas/core/accessor.py +++ b/pandas/core/accessor.py @@ -12,7 +12,8 @@ class DirNamesMixin(object): _accessors = frozenset([]) - _deprecations = frozenset(['asobject']) + _deprecations = frozenset( + ['asobject', 'base', 'data', 'flags', 'itemsize', 'strides']) def _dir_deletions(self): """ delete unwanted __dir__ for this object """ From a54b4167db2216768b6da87365bea3b11cd1d015 Mon Sep 17 00:00:00 2001 From: tp Date: Sat, 19 May 2018 08:22:48 +0100 Subject: [PATCH 2/2] add test for depr. attibute added to deprecation list --- doc/source/whatsnew/v0.23.1.txt | 2 ++ pandas/tests/indexes/test_base.py | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/doc/source/whatsnew/v0.23.1.txt b/doc/source/whatsnew/v0.23.1.txt index 9382d74f95295..c8a2076064c02 100644 --- a/doc/source/whatsnew/v0.23.1.txt +++ b/doc/source/whatsnew/v0.23.1.txt @@ -44,6 +44,8 @@ Documentation Changes Bug Fixes ~~~~~~~~~ +- tab completion on :class:`Index` in IPython no longer outputs deprecation warnings (:issue:`21125`) + Groupby/Resample/Rolling ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/pandas/tests/indexes/test_base.py b/pandas/tests/indexes/test_base.py index f4fa547574b9e..1e4dd2921b3f5 100644 --- a/pandas/tests/indexes/test_base.py +++ b/pandas/tests/indexes/test_base.py @@ -2088,6 +2088,17 @@ def test_get_duplicates_deprecated(self): with tm.assert_produces_warning(FutureWarning): index.get_duplicates() + def test_tab_complete_warning(self, ip): + # https://github.com/pandas-dev/pandas/issues/16409 + pytest.importorskip('IPython', minversion="6.0.0") + from IPython.core.completer import provisionalcompleter + + code = "import pandas as pd; idx = pd.Index([1, 2])" + ip.run_code(code) + with tm.assert_produces_warning(None): + with provisionalcompleter('ignore'): + list(ip.Completer.completions('idx.', 4)) + class TestMixedIntIndex(Base): # Mostly the tests from common.py for which the results differ