-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
/
Copy pathtest_warnings.py
30 lines (23 loc) · 1.12 KB
/
test_warnings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import pytest
import pandas as pd
import pandas.util.testing as tm
class TestCategoricalWarnings:
@pytest.mark.asyncio
async 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; c = Categorical([])"
await ip.run_code(code)
with tm.assert_produces_warning(None):
with provisionalcompleter("ignore"):
list(ip.Completer.completions("c.", 1))
def test_CategoricalAccessor_categorical_deprecation(self):
with tm.assert_produces_warning(FutureWarning):
pd.Series(["a", "b"], dtype="category").cat.categorical
def test_CategoricalAccessor_name_deprecation(self):
with tm.assert_produces_warning(FutureWarning):
pd.Series(["a", "b"], dtype="category").cat.name
def test_CategoricalAccessor_index_deprecation(self):
with tm.assert_produces_warning(FutureWarning):
pd.Series(["a", "b"], dtype="category").cat.index