File tree 1 file changed +9
-6
lines changed
1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -49,27 +49,30 @@ def test_setattr_warnings():
49
49
df = pd .DataFrame (d )
50
50
51
51
with catch_warnings (record = True ) as w :
52
- # successfully add new column
52
+ # successfully add new column
53
+ # this should not raise a warning
53
54
df ['three' ] = df .two + 1
54
55
assert len (w ) == 0
55
56
assert df .three .sum () > df .two .sum ()
56
57
57
58
with catch_warnings (record = True ) as w :
58
- # successfully modify column in place
59
+ # successfully modify column in place
60
+ # this should not raise a warning
59
61
df .one += 1
60
62
assert len (w ) == 0
61
63
assert df .one .iloc [0 ] == 2
62
64
63
65
with catch_warnings (record = True ) as w :
64
- # successfully add an attribute to a series
66
+ # successfully add an attribute to a series
67
+ # this should not raise a warning
65
68
df .two .not_an_index = [1 , 2 ]
66
69
assert len (w ) == 0
67
70
68
71
with tm .assert_produces_warning (UserWarning ):
69
- # warn when setting column to nonexistent name
72
+ # warn when setting column to nonexistent name
70
73
df .four = df .two + 2
71
74
assert df .four .sum () > df .two .sum ()
72
-
75
+
73
76
with tm .assert_produces_warning (UserWarning ):
74
- # warn when column has same name as method
77
+ # warn when column has same name as method
75
78
df ['sum' ] = df .two
You can’t perform that action at this time.
0 commit comments