mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed SortedDict.__copy__()
Fixed #18175 -- Calling SortedDict.__copy__() resulted in changes to the original dictionary. The reason was likely related to subclassing dict. Thanks to linovia for report and patch.
This commit is contained in:
@@ -111,6 +111,12 @@ class SortedDictTests(SimpleTestCase):
|
||||
{7: 'seven', 1: 'one', 9: 'nine'}
|
||||
)
|
||||
|
||||
def test_copy(self):
|
||||
orig = SortedDict(((1, "one"), (0, "zero"), (2, "two")))
|
||||
copied = copy.copy(orig)
|
||||
self.assertEqual(orig.keys(), [1, 0, 2])
|
||||
self.assertEqual(copied.keys(), [1, 0, 2])
|
||||
|
||||
def test_clear(self):
|
||||
self.d1.clear()
|
||||
self.assertEqual(self.d1, {})
|
||||
|
||||
Reference in New Issue
Block a user