Skip to content

Commit

Permalink
check that objects are not deallocated before end of autorelease pool
Browse files Browse the repository at this point in the history
  • Loading branch information
samschott committed Nov 25, 2024
1 parent 52e92c0 commit efed734
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1895,8 +1895,11 @@ def test_objcinstance_created_gc_released(self):
del obj
gc.collect()

# Assert that the obj was deallocated.
self.assertIsNone(wr.weak_property)
self.assertIsNotNone(
wr.weak_property, "object was deallocated before end of autorelease pool"
)

self.assertIsNone(wr.weak_property, "object was not deallocated")

def test_objcinstance_explicit_retained_gc_released(self):
with autoreleasepool():
Expand All @@ -1911,8 +1914,11 @@ def test_objcinstance_explicit_retained_gc_released(self):
del obj
gc.collect()

# Assert that the obj was deallocated.
self.assertIsNone(wr.weak_property)
self.assertIsNotNone(
wr.weak_property, "object was deallocated before end of autorelease pool"
)

self.assertIsNone(wr.weak_property, "object was not deallocated")

def test_objcinstance_dealloc(self):

Expand Down

0 comments on commit efed734

Please sign in to comment.