def test_timed(self): # Test that a wrapped method... @timed def testfunc(repo, doc): pass # ...passed a particular docrepo and doc mockrepo = Mock() mockdoc = Mock() mockdoc.basefile = "1234" # ...has it's instances logger called... testfunc(mockrepo, mockdoc) call_args = mockrepo.log.info.call_args # ...with the correct method and arguments self.assertEqual(len(call_args[0]), 2) self.assertEqual(call_args[0][0], 'parse OK (%.3f sec)')
def test_timed(self): # Test that a wrapped method... @timed def testfunc(repo,doc): pass # ...passed a particular docrepo and doc mockrepo = Mock() mockdoc = Mock() mockdoc.basefile = "1234" # ...has it's instances logger called... testfunc(mockrepo,mockdoc) call_args = mockrepo.log.info.call_args # ...with the correct method and arguments self.assertEqual(len(call_args[0]), 3) self.assertEqual(call_args[0][0], '%s: parse OK (%.3f sec)') self.assertEqual(call_args[0][1], "1234")