@@ -94,7 +94,6 @@ def _axify(obj, key, axis):
94
94
def _mklbl (prefix , n ):
95
95
return ["%s%s" % (prefix , i ) for i in range (n )]
96
96
97
-
98
97
class TestIndexing (tm .TestCase ):
99
98
100
99
_multiprocess_can_split_ = True
@@ -279,6 +278,11 @@ def _print(result, error=None):
279
278
k2 = key2
280
279
_eq (t , o , a , obj , key1 , k2 )
281
280
281
+ #GH14554: used to make sure recursion errors bubble up as expected
282
+ recursive_df = pd .DataFrame ({'a' :[1 ,]}, index = ['a' ])
283
+ def recursive_indexing_function (self , a ):
284
+ return self .recursive_indexing_function (self .recursive_df .loc [['a' ], ['a' ]])
285
+
282
286
def test_indexer_caching (self ):
283
287
# GH5727
284
288
# make sure that indexers are in the _internal_names_set
@@ -1216,7 +1220,19 @@ def test_loc_getitem_bool(self):
1216
1220
self .check_result ('bool' , 'loc' , b , 'ix' , b ,
1217
1221
typs = ['ints' , 'labels' , 'mixed' , 'ts' , 'floats' ])
1218
1222
self .check_result ('bool' , 'loc' , b , 'ix' , b , typs = ['empty' ],
1219
- fails = IndexError )
1223
+ fails = KeyError )
1224
+
1225
+ def test_recursion_fails_loc (self ):
1226
+ #GH14554
1227
+ #RuntimeError should bubble up if appropriate, rather
1228
+ #than method specific exception
1229
+ oldVal = sys .getrecursionlimit ()
1230
+ sys .setrecursionlimit (50 )
1231
+ with self .assertRaises (RuntimeError ):
1232
+ try :
1233
+ self .recursive_indexing_function (1 )
1234
+ finally :
1235
+ sys .setrecursionlimit (oldVal )
1220
1236
1221
1237
def test_loc_getitem_int_slice (self ):
1222
1238
0 commit comments