def test_get_loc_msg(self):
        idx = period_range('2000-1-1', freq='A', periods=10)
        bad_period = Period('2012', 'A')
        self.assertRaises(KeyError, idx.get_loc, bad_period)

        try:
            idx.get_loc(bad_period)
        except __HOLE__ as inst:
            self.assertEqual(inst.args[0], bad_period)
dataset/ETHPy150Open pydata/pandas/pandas/tseries/tests/test_period.py/TestPeriodIndex.test_get_loc_msg