File tree 1 file changed +18
-0
lines changed
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,24 @@ def test_column_contains_typeerror(self):
128
128
except TypeError :
129
129
pass
130
130
131
+ def test_tab_completion (self ):
132
+ # DataFrame whose columns are identifiers shall have them in __dir__.
133
+ df = pd .DataFrame ([list ('abcd' ), list ('efgh' )], columns = list ('ABCD' ))
134
+ for key in list ('ABCD' ):
135
+ assert key in dir (df )
136
+ assert isinstance (df .__getitem__ ('A' ), pd .Series )
137
+
138
+ # DataFrame whose first-level columns are identifiers shall have
139
+ # them in __dir__.
140
+ df = pd .DataFrame (
141
+ [list ('abcd' ), list ('efgh' )],
142
+ columns = pd .MultiIndex .from_tuples (list (zip ('ABCD' , 'EFGH' ))))
143
+ for key in list ('ABCD' ):
144
+ assert key in dir (df )
145
+ for key in list ('EFGH' ):
146
+ assert key not in dir (df )
147
+ assert isinstance (df .__getitem__ ('A' ), pd .DataFrame )
148
+
131
149
def test_not_hashable (self ):
132
150
df = self .klass ([1 ])
133
151
pytest .raises (TypeError , hash , df )
You can’t perform that action at this time.
0 commit comments