summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_uuid.py
diff options
context:
space:
mode:
authorDavid H <dhdavvie@gmail.com>2019-01-17 12:16:51 (GMT)
committerVictor Stinner <vstinner@redhat.com>2019-01-17 12:16:51 (GMT)
commitf1d8e7cf17a010d2657822e06a41b30c9542a8c7 (patch)
tree13df0aa117053b710a04945c59e978de524e802f /Lib/test/test_uuid.py
parent89669ffe10a9db6343f6ee42239e412c8ad96bde (diff)
downloadcpython-f1d8e7cf17a010d2657822e06a41b30c9542a8c7.zip
cpython-f1d8e7cf17a010d2657822e06a41b30c9542a8c7.tar.gz
cpython-f1d8e7cf17a010d2657822e06a41b30c9542a8c7.tar.bz2
bpo-35701: Added __weakref__ slot to uuid.UUID (GH-11570)
Added test for weakreferencing a uuid.UUID object.
Diffstat (limited to 'Lib/test/test_uuid.py')
-rw-r--r--Lib/test/test_uuid.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_uuid.py b/Lib/test/test_uuid.py
index 757bf3c..992ef0c 100644
--- a/Lib/test/test_uuid.py
+++ b/Lib/test/test_uuid.py
@@ -9,6 +9,7 @@ import pickle
import shutil
import subprocess
import sys
+import weakref
from unittest import mock
py_uuid = support.import_fresh_module('uuid', blocked=['_uuid'])
@@ -657,6 +658,11 @@ class BaseTestUUID:
self.assertNotEqual(parent_value, child_value)
+ def test_uuid_weakref(self):
+ # bpo-35701: check that weak referencing to a UUID object can be created
+ strong = self.uuid.uuid4()
+ weak = weakref.ref(strong)
+ self.assertIs(strong, weak())
class TestUUIDWithoutExtModule(BaseTestUUID, unittest.TestCase):
uuid = py_uuid