def testNoLeak2(self): helper = _memory_checker_test_helper.MemoryCheckerTestHelper() with MemoryChecker() as memory_checker: memory_checker.record_snapshot() helper.list_push_back(10) memory_checker.record_snapshot() memory_checker.record_snapshot() memory_checker.record_snapshot() memory_checker.report() memory_checker.assert_no_leak_if_all_possibly_except_one()
def testLeak4(self): helper = _memory_checker_test_helper.MemoryCheckerTestHelper() with MemoryChecker() as memory_checker: for i in range(10): helper.list_push_back(i) memory_checker.record_snapshot() memory_checker.report() with self.assertRaises(AssertionError): memory_checker.assert_no_leak_if_all_possibly_except_one()