diff options
author | Zachary Ware <zachary.ware@gmail.com> | 2015-12-21 14:17:12 -0600 |
---|---|---|
committer | Zachary Ware <zachary.ware@gmail.com> | 2015-12-21 14:17:12 -0600 |
commit | f2b234443c53cb73dc749da57d952286437cb15a (patch) | |
tree | f21b8b25f5bfbe76a2c85ae62f6d06060dd03372 /Lib/test/lock_tests.py | |
parent | 26b842a82d9ae7d30c692080bf352a0ef78a626c (diff) | |
parent | 977fd6d7c6593680fd5ffdebb262a2a3f2f24387 (diff) | |
download | cpython-f2b234443c53cb73dc749da57d952286437cb15a.tar.gz |
Issue #25827: Merge with 3.5
Diffstat (limited to 'Lib/test/lock_tests.py')
-rw-r--r-- | Lib/test/lock_tests.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/lock_tests.py b/Lib/test/lock_tests.py index afd6873683..055bf28565 100644 --- a/Lib/test/lock_tests.py +++ b/Lib/test/lock_tests.py @@ -7,6 +7,7 @@ import time from _thread import start_new_thread, TIMEOUT_MAX import threading import unittest +import weakref from test import support @@ -198,6 +199,17 @@ class BaseLockTests(BaseTestCase): self.assertFalse(results[0]) self.assertTimeout(results[1], 0.5) + def test_weakref_exists(self): + lock = self.locktype() + ref = weakref.ref(lock) + self.assertIsNotNone(ref()) + + def test_weakref_deleted(self): + lock = self.locktype() + ref = weakref.ref(lock) + del lock + self.assertIsNone(ref()) + class LockTests(BaseLockTests): """ |