@@ -16,32 +16,27 @@ class TestLoc(Base):
1616 def test_loc_getitem_int (self ):
1717
1818 # int label
19- self .check_result ("loc" , 2 , "loc" , 2 , typs = ["label " ], fails = KeyError )
19+ self .check_result ("loc" , 2 , typs = ["labels " ], fails = TypeError )
2020
2121 def test_loc_getitem_label (self ):
2222
2323 # label
24- self .check_result ("loc" , "c" , "loc" , "c" , typs = ["empty" ], fails = KeyError )
24+ self .check_result ("loc" , "c" , typs = ["empty" ], fails = KeyError )
2525
2626 def test_loc_getitem_label_out_of_range (self ):
2727
2828 # out of range label
2929 self .check_result (
30- "loc" ,
31- "f" ,
32- "loc" ,
33- "f" ,
34- typs = ["ints" , "uints" , "labels" , "mixed" , "ts" ],
35- fails = KeyError ,
30+ "loc" , "f" , typs = ["ints" , "uints" , "labels" , "mixed" , "ts" ], fails = KeyError ,
3631 )
37- self .check_result ("loc" , "f" , "ix" , "f" , typs = ["floats" ], fails = KeyError )
38- self .check_result ("loc" , "f" , "loc" , "f" , typs = ["floats" ], fails = KeyError )
32+ self .check_result ("loc" , "f" , typs = ["floats" ], fails = KeyError )
33+ self .check_result ("loc" , "f" , typs = ["floats" ], fails = KeyError )
3934 self .check_result (
40- "loc" , 20 , "loc" , 20 , typs = ["ints" , "uints" , "mixed" ], fails = KeyError ,
35+ "loc" , 20 , typs = ["ints" , "uints" , "mixed" ], fails = KeyError ,
4136 )
42- self .check_result ("loc" , 20 , "loc" , 20 , typs = ["labels" ], fails = TypeError )
43- self .check_result ("loc" , 20 , "loc" , 20 , typs = ["ts" ], axes = 0 , fails = TypeError )
44- self .check_result ("loc" , 20 , "loc" , 20 , typs = ["floats" ], axes = 0 , fails = KeyError )
37+ self .check_result ("loc" , 20 , typs = ["labels" ], fails = TypeError )
38+ self .check_result ("loc" , 20 , typs = ["ts" ], axes = 0 , fails = TypeError )
39+ self .check_result ("loc" , 20 , typs = ["floats" ], axes = 0 , fails = KeyError )
4540
4641 def test_loc_getitem_label_list (self ):
4742 # TODO: test something here?
@@ -50,49 +45,25 @@ def test_loc_getitem_label_list(self):
5045
5146 def test_loc_getitem_label_list_with_missing (self ):
5247 self .check_result (
53- "loc" , [0 , 1 , 2 ], "loc" , [ 0 , 1 , 2 ], typs = ["empty" ], fails = KeyError ,
48+ "loc" , [0 , 1 , 2 ], typs = ["empty" ], fails = KeyError ,
5449 )
5550 self .check_result (
56- "loc" ,
57- [0 , 2 , 10 ],
58- "ix" ,
59- [0 , 2 , 10 ],
60- typs = ["ints" , "uints" , "floats" ],
61- axes = 0 ,
62- fails = KeyError ,
51+ "loc" , [0 , 2 , 10 ], typs = ["ints" , "uints" , "floats" ], axes = 0 , fails = KeyError ,
6352 )
6453
6554 self .check_result (
66- "loc" ,
67- [3 , 6 , 7 ],
68- "ix" ,
69- [3 , 6 , 7 ],
70- typs = ["ints" , "uints" , "floats" ],
71- axes = 1 ,
72- fails = KeyError ,
55+ "loc" , [3 , 6 , 7 ], typs = ["ints" , "uints" , "floats" ], axes = 1 , fails = KeyError ,
7356 )
7457
7558 # GH 17758 - MultiIndex and missing keys
7659 self .check_result (
77- "loc" ,
78- [(1 , 3 ), (1 , 4 ), (2 , 5 )],
79- "ix" ,
80- [(1 , 3 ), (1 , 4 ), (2 , 5 )],
81- typs = ["multi" ],
82- axes = 0 ,
83- fails = KeyError ,
60+ "loc" , [(1 , 3 ), (1 , 4 ), (2 , 5 )], typs = ["multi" ], axes = 0 , fails = KeyError ,
8461 )
8562
8663 def test_loc_getitem_label_list_fails (self ):
8764 # fails
8865 self .check_result (
89- "loc" ,
90- [20 , 30 , 40 ],
91- "loc" ,
92- [20 , 30 , 40 ],
93- typs = ["ints" , "uints" ],
94- axes = 1 ,
95- fails = KeyError ,
66+ "loc" , [20 , 30 , 40 ], typs = ["ints" , "uints" ], axes = 1 , fails = KeyError ,
9667 )
9768
9869 def test_loc_getitem_label_array_like (self ):
@@ -104,7 +75,7 @@ def test_loc_getitem_bool(self):
10475 # boolean indexers
10576 b = [True , False , True , False ]
10677
107- self .check_result ("loc" , b , "loc" , b , typs = ["empty" ], fails = IndexError )
78+ self .check_result ("loc" , b , typs = ["empty" ], fails = IndexError )
10879
10980 def test_loc_getitem_label_slice (self ):
11081
@@ -115,51 +86,25 @@ def test_loc_getitem_label_slice(self):
11586 # GH 14316
11687
11788 self .check_result (
118- "loc" ,
119- slice (1 , 3 ),
12089 "loc" ,
12190 slice (1 , 3 ),
12291 typs = ["labels" , "mixed" , "empty" , "ts" , "floats" ],
12392 fails = TypeError ,
12493 )
12594
12695 self .check_result (
127- "loc" ,
128- slice ("20130102" , "20130104" ),
129- "loc" ,
130- slice ("20130102" , "20130104" ),
131- typs = ["ts" ],
132- axes = 1 ,
133- fails = TypeError ,
96+ "loc" , slice ("20130102" , "20130104" ), typs = ["ts" ], axes = 1 , fails = TypeError ,
13497 )
13598
13699 self .check_result (
137- "loc" ,
138- slice (2 , 8 ),
139- "loc" ,
140- slice (2 , 8 ),
141- typs = ["mixed" ],
142- axes = 0 ,
143- fails = TypeError ,
100+ "loc" , slice (2 , 8 ), typs = ["mixed" ], axes = 0 , fails = TypeError ,
144101 )
145102 self .check_result (
146- "loc" ,
147- slice (2 , 8 ),
148- "loc" ,
149- slice (2 , 8 ),
150- typs = ["mixed" ],
151- axes = 1 ,
152- fails = KeyError ,
103+ "loc" , slice (2 , 8 ), typs = ["mixed" ], axes = 1 , fails = KeyError ,
153104 )
154105
155106 self .check_result (
156- "loc" ,
157- slice (2 , 4 , 2 ),
158- "loc" ,
159- slice (2 , 4 , 2 ),
160- typs = ["mixed" ],
161- axes = 0 ,
162- fails = TypeError ,
107+ "loc" , slice (2 , 4 , 2 ), typs = ["mixed" ], axes = 0 , fails = TypeError ,
163108 )
164109
165110
0 commit comments