We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 881e434 commit 87dafdaCopy full SHA for 87dafda
pandas/tests/dtypes/test_generic.py
@@ -4,6 +4,7 @@
4
import numpy as np
5
import pandas as pd
6
from pandas.core.dtypes import generic as gt
7
+import pytest
8
9
10
class TestABCClasses(object):
@@ -17,6 +18,7 @@ class TestABCClasses(object):
17
18
df = pd.DataFrame({'names': ['a', 'b', 'c']}, index=multi_index)
19
sparse_series = pd.Series([1, 2, 3]).to_sparse()
20
sparse_array = pd.SparseArray(np.random.randn(10))
21
+ series = pd.Series([1, 2, 3])
22
23
def test_abc_types(self):
24
assert isinstance(pd.Index(['a', 'b', 'c']), gt.ABCIndex)
@@ -38,3 +40,8 @@ def test_abc_types(self):
38
40
assert isinstance(self.sparse_array, gt.ABCSparseArray)
39
41
assert isinstance(self.categorical, gt.ABCCategorical)
42
assert isinstance(pd.Period('2012', freq='A-DEC'), gt.ABCPeriod)
43
+ with catch_warnings(record=True) as w:
44
+ self.series.not_an_index = [1, 2]
45
+ assert len(w) == 0 # fail if false warning on Series
46
+ with pytest.warns(UserWarning):
47
+ self.df.not_a_column = [1, 2]
0 commit comments