File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,20 @@ def test_column_contains_typeerror(self):
128128 except TypeError :
129129 pass
130130
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+ assert 'A' in dir (df )
135+ assert isinstance (df .__getitem__ ('A' ), pd .Series )
136+
137+ # DataFrame whose first-level columns are identifiers shall have
138+ # them in __dir__.
139+ df = pd .DataFrame (
140+ [list ('abcd' ), list ('efgh' )],
141+ columns = pd .MultiIndex .from_tuples (list (zip ('ABCD' , 'EFGH' ))))
142+ assert 'A' in dir (df )
143+ assert isinstance (df .__getitem__ ('A' ), pd .DataFrame )
144+
131145 def test_not_hashable (self ):
132146 df = self .klass ([1 ])
133147 pytest .raises (TypeError , hash , df )
You can’t perform that action at this time.
0 commit comments