Skip to content

Instantly share code, notes, and snippets.

@mithrandi
Created January 8, 2015 07:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mithrandi/10ef1d58f3ee2d189632 to your computer and use it in GitHub Desktop.
Save mithrandi/10ef1d58f3ee2d189632 to your computer and use it in GitHub Desktop.
Test for thing
def test_storeOverCollectedItem(self):
"""
If an item is replaced in the cache, the finalizer from the first item
does not remove the second item.
"""
o1 = Object(1)
self.cache.cache(42, o1)
gc.disable()
del o1
gc.collect()
o2 = Object(2)
self.cache.cache(42, o2)
gc.enable()
self.assertEqual(2, self.cache.get(42).name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment