diff options
| author | Alex Gaynor <alex.gaynor@gmail.com> | 2010-10-27 20:39:20 +0000 |
|---|---|---|
| committer | Alex Gaynor <alex.gaynor@gmail.com> | 2010-10-27 20:39:20 +0000 |
| commit | c6f90f00535ab55d36fe687305d4aebdad197001 (patch) | |
| tree | ba5d0ee909cfff56f187afc972202c1832c40bf5 /tests | |
| parent | 3d69b217901ba4ea094b7999ba931ad1c20a61e7 (diff) | |
Fixed MultiValueDict's copy implementation to be consistant with all other copies.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14366 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/utils/datastructures.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/regressiontests/utils/datastructures.py b/tests/regressiontests/utils/datastructures.py index a41281cd37..3c29a24a63 100644 --- a/tests/regressiontests/utils/datastructures.py +++ b/tests/regressiontests/utils/datastructures.py @@ -4,6 +4,7 @@ Tests for stuff in django.utils.datastructures. import pickle import unittest +from django.utils.copycompat import copy from django.utils.datastructures import * @@ -211,6 +212,26 @@ class MultiValueDictTests(DatastructuresTestCase): self.assertEquals(list(d.itervalues()), ['Developer', 'Simon', 'Willison']) + def test_copy(self): + for copy_func in [copy, lambda d: d.copy()]: + d1 = MultiValueDict({ + "developers": ["Carl", "Fred"] + }) + self.assertEqual(d1["developers"], "Fred") + d2 = copy_func(d1) + d2.update({"developers": "Groucho"}) + self.assertEqual(d2["developers"], "Groucho") + self.assertEqual(d1["developers"], "Fred") + + d1 = MultiValueDict({ + "key": [[]] + }) + self.assertEqual(d1["key"], []) + d2 = copy_func(d1) + d2["key"].append("Penguin") + self.assertEqual(d1["key"], ["Penguin"]) + self.assertEqual(d2["key"], ["Penguin"]) + class DotExpandedDictTests(DatastructuresTestCase): |
