def test_simple(self): # test decorated = Log('{id}')(foo) decorated._log(None, None, 1) # verify self.assertEquals(1, len(self.logs)) self.assertEquals(logging.INFO, self.logs[0].level) self.assertEquals('1', self.logs[0].msg) self.assertIsNone(self.logs[0].exc_info)
def test_exc_info(self): decorated = Log('{id}', exc_info=True)(foo) try: raise Exception() except: decorated._log(None, None, 1) # verify self.assertEquals(1, len(self.logs)) self.assertEquals(logging.INFO, self.logs[0].level) self.assertEquals('1', self.logs[0].msg) self.assertTrue(self.logs[0].exc_info)