comparison tests/test_pymonkey.py @ 129:7b7a23615873

Added weakref support for runtimes.
author Atul Varma <varmaa@toolness.com>
date Sun, 23 Aug 2009 17:52:47 -0700
parents 4179d1e1a75c
children a9c0db56e06b
comparison
equal deleted inserted replaced
128:1e4d4d475e75 129:7b7a23615873
457 def testContextGetRuntimeWorks(self): 457 def testContextGetRuntimeWorks(self):
458 rt = pymonkey.Runtime() 458 rt = pymonkey.Runtime()
459 cx = rt.new_context() 459 cx = rt.new_context()
460 self.assertEqual(cx.get_runtime(), rt) 460 self.assertEqual(cx.get_runtime(), rt)
461 461
462 def testRuntimesAreWeakReferencable(self):
463 rt = pymonkey.Runtime()
464 wrt = weakref.ref(rt)
465 self.assertEqual(rt, wrt())
466 del rt
467 self.assertEqual(wrt(), None)
468
462 def testContextsAreWeakReferencable(self): 469 def testContextsAreWeakReferencable(self):
463 rt = pymonkey.Runtime() 470 rt = pymonkey.Runtime()
464 cx = rt.new_context() 471 cx = rt.new_context()
465 wcx = weakref.ref(cx) 472 wcx = weakref.ref(cx)
466 self.assertEqual(cx, wcx()) 473 self.assertEqual(cx, wcx())