@@ -29,13 +29,11 @@ def test_loc_getitem_label_out_of_range(self):
2929
3030 # out of range label
3131 self .check_result (
32- "loc" , "f" , typs = ["ints" , "uints" , "labels" , "mixed" , "ts" ], fails = KeyError ,
32+ "loc" , "f" , typs = ["ints" , "uints" , "labels" , "mixed" , "ts" ], fails = KeyError
3333 )
3434 self .check_result ("loc" , "f" , typs = ["floats" ], fails = KeyError )
3535 self .check_result ("loc" , "f" , typs = ["floats" ], fails = KeyError )
36- self .check_result (
37- "loc" , 20 , typs = ["ints" , "uints" , "mixed" ], fails = KeyError ,
38- )
36+ self .check_result ("loc" , 20 , typs = ["ints" , "uints" , "mixed" ], fails = KeyError )
3937 self .check_result ("loc" , 20 , typs = ["labels" ], fails = KeyError )
4038 self .check_result ("loc" , 20 , typs = ["ts" ], axes = 0 , fails = KeyError )
4139 self .check_result ("loc" , 20 , typs = ["floats" ], axes = 0 , fails = KeyError )
@@ -46,26 +44,24 @@ def test_loc_getitem_label_list(self):
4644 pass
4745
4846 def test_loc_getitem_label_list_with_missing (self ):
47+ self .check_result ("loc" , [0 , 1 , 2 ], typs = ["empty" ], fails = KeyError )
4948 self .check_result (
50- "loc" , [0 , 1 , 2 ], typs = ["empty" ], fails = KeyError ,
51- )
52- self .check_result (
53- "loc" , [0 , 2 , 10 ], typs = ["ints" , "uints" , "floats" ], axes = 0 , fails = KeyError ,
49+ "loc" , [0 , 2 , 10 ], typs = ["ints" , "uints" , "floats" ], axes = 0 , fails = KeyError
5450 )
5551
5652 self .check_result (
57- "loc" , [3 , 6 , 7 ], typs = ["ints" , "uints" , "floats" ], axes = 1 , fails = KeyError ,
53+ "loc" , [3 , 6 , 7 ], typs = ["ints" , "uints" , "floats" ], axes = 1 , fails = KeyError
5854 )
5955
6056 # GH 17758 - MultiIndex and missing keys
6157 self .check_result (
62- "loc" , [(1 , 3 ), (1 , 4 ), (2 , 5 )], typs = ["multi" ], axes = 0 , fails = KeyError ,
58+ "loc" , [(1 , 3 ), (1 , 4 ), (2 , 5 )], typs = ["multi" ], axes = 0 , fails = KeyError
6359 )
6460
6561 def test_loc_getitem_label_list_fails (self ):
6662 # fails
6763 self .check_result (
68- "loc" , [20 , 30 , 40 ], typs = ["ints" , "uints" ], axes = 1 , fails = KeyError ,
64+ "loc" , [20 , 30 , 40 ], typs = ["ints" , "uints" ], axes = 1 , fails = KeyError
6965 )
7066
7167 def test_loc_getitem_label_array_like (self ):
@@ -95,18 +91,14 @@ def test_loc_getitem_label_slice(self):
9591 )
9692
9793 self .check_result (
98- "loc" , slice ("20130102" , "20130104" ), typs = ["ts" ], axes = 1 , fails = TypeError ,
94+ "loc" , slice ("20130102" , "20130104" ), typs = ["ts" ], axes = 1 , fails = TypeError
9995 )
10096
101- self .check_result (
102- "loc" , slice (2 , 8 ), typs = ["mixed" ], axes = 0 , fails = TypeError ,
103- )
104- self .check_result (
105- "loc" , slice (2 , 8 ), typs = ["mixed" ], axes = 1 , fails = KeyError ,
106- )
97+ self .check_result ("loc" , slice (2 , 8 ), typs = ["mixed" ], axes = 0 , fails = TypeError )
98+ self .check_result ("loc" , slice (2 , 8 ), typs = ["mixed" ], axes = 1 , fails = KeyError )
10799
108100 self .check_result (
109- "loc" , slice (2 , 4 , 2 ), typs = ["mixed" ], axes = 0 , fails = TypeError ,
101+ "loc" , slice (2 , 4 , 2 ), typs = ["mixed" ], axes = 0 , fails = TypeError
110102 )
111103
112104 def test_setitem_from_duplicate_axis (self ):
@@ -669,8 +661,7 @@ def test_loc_setitem_with_scalar_index(self, indexer, value):
669661 (1 , ["A" , "B" , "C" ]),
670662 np .array ([7 , 8 , 9 ], dtype = np .int64 ),
671663 pd .DataFrame (
672- [[1 , 2 , np .nan ], [7 , 8 , 9 ], [5 , 6 , np .nan ]],
673- columns = ["A" , "B" , "C" ],
664+ [[1 , 2 , np .nan ], [7 , 8 , 9 ], [5 , 6 , np .nan ]], columns = ["A" , "B" , "C" ]
674665 ),
675666 ),
676667 (
0 commit comments