Skip to content

Commit 4cc0970

Browse files
author
y-p
committed
TST: nested exceptions clobber the exception context, must reraise with named arg
1 parent 46ef8a6 commit 4cc0970

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pandas/tests/test_frame.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,6 +1295,21 @@ def test_iget_value(self):
12951295
expected = self.frame.get_value(row, col)
12961296
assert_almost_equal(result, expected)
12971297

1298+
def test_nested_exception(self):
1299+
# Ignore the strange way of triggering the problem
1300+
# (which may get fixed), it's just a way to trigger
1301+
# the issue or reraising an outer exception without
1302+
# a named argument
1303+
df=DataFrame({"a":[1,2,3],"b":[4,5,6],"c":[7,8,9]}).set_index(["a","b"])
1304+
l=list(df.index)
1305+
l[0]=["a","b"]
1306+
df.index=l
1307+
1308+
try:
1309+
print df
1310+
except Exception,e:
1311+
self.assertNotEqual(type(e),UnboundLocalError)
1312+
12981313
_seriesd = tm.getSeriesData()
12991314
_tsd = tm.getTimeSeriesData()
13001315

0 commit comments

Comments
 (0)