mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-35701: Added __weakref__ slot to uuid.UUID (GH-11570)
Added test for weakreferencing a uuid.UUID object.
This commit is contained in:
parent
89669ffe10
commit
f1d8e7cf17
2 changed files with 7 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue