Closed
Description
The following two tests seem inconsistent. Why does the first test for a KeyError
while the second tests for a ValueError
? Also, the first error message, Level foo not found
, doesn't seem correct.
test_index.py
:
def test_duplicate_names(self):
self.index.names = ['foo', 'foo']
assertRaisesRegexp(KeyError, 'Level foo not found',
self.index._get_level_number, 'foo')
test_frame.py
:
def test_unstack_non_unique_index_names(self):
idx = MultiIndex.from_tuples([('a', 'b'), ('c', 'd')],
names=['c1', 'c1'])
df = DataFrame([1, 2], index=idx)
with tm.assertRaises(ValueError):
df.unstack('c1')
with tm.assertRaises(ValueError):
df.T.stack('c1')