-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
ENH: Add warning when setting into nonexistent attribute #16951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
b5dde1e
4d3f87d
fb29857
af5ab38
f485e77
bfb9f93
61eca9d
15ebdbc
30d98de
8d38f68
c9c43db
0a25a56
150d586
02cb426
562c164
f3fdd19
c6fe062
8ad4d05
e5cc166
e02244d
d38ecca
b86546e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
import numpy as np | ||
import pandas as pd | ||
from pandas.core.dtypes import generic as gt | ||
import pytest | ||
|
||
|
||
class TestABCClasses(object): | ||
|
@@ -17,6 +18,7 @@ class TestABCClasses(object): | |
df = pd.DataFrame({'names': ['a', 'b', 'c']}, index=multi_index) | ||
sparse_series = pd.Series([1, 2, 3]).to_sparse() | ||
sparse_array = pd.SparseArray(np.random.randn(10)) | ||
series = pd.Series([1, 2, 3]) | ||
|
||
def test_abc_types(self): | ||
assert isinstance(pd.Index(['a', 'b', 'c']), gt.ABCIndex) | ||
|
@@ -38,3 +40,8 @@ def test_abc_types(self): | |
assert isinstance(self.sparse_array, gt.ABCSparseArray) | ||
assert isinstance(self.categorical, gt.ABCCategorical) | ||
assert isinstance(pd.Period('2012', freq='A-DEC'), gt.ABCPeriod) | ||
with catch_warnings(record=True) as w: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what are you testing here? |
||
self.series.not_an_index = [1, 2] | ||
assert len(w) == 0 # fail if false warning on Series | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move this to a new test add the issue number as a comment |
||
with pytest.warns(UserWarning): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use |
||
self.df.not_a_column = [1, 2] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
u can remove this