summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBaptiste Mispelon <bmispelon@gmail.com>2014-09-16 12:17:33 +0200
committerBaptiste Mispelon <bmispelon@gmail.com>2014-09-16 12:24:01 +0200
commit04e7c7d51f832407c49c3abb3413fbfbdb410f6f (patch)
tree16ed1c5d5b3b28c6fe2a9511b7a96aadea146eb0 /tests
parent68ab3b1ac1baa1509c8c31c124620849ad19c527 (diff)
[1.7.x] Fixed #23492 -- Restored F.__deepcopy__.
This reverts commit 3a66035107a640c4905f0a5f247a45f32dbe16d7. A regression test was also added. Backport of d63ac5b595694c44ed8a64d782a177d2f92125d9 from master.
Diffstat (limited to 'tests')
-rw-r--r--tests/expressions/tests.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py
index 320271b1dc..0430fd0358 100644
--- a/tests/expressions/tests.py
+++ b/tests/expressions/tests.py
@@ -1,5 +1,7 @@
from __future__ import unicode_literals
+from copy import deepcopy
+
from django.core.exceptions import FieldError
from django.db.models import F
from django.db import transaction
@@ -281,3 +283,11 @@ class ExpressionsTests(TestCase):
company_ceo_set__num_employees=F('company_ceo_set__num_employees')
)
self.assertEqual(str(qs.query).count('JOIN'), 2)
+
+ def test_F_object_deepcopy(self):
+ """
+ Make sure F objects can be deepcopied (#23492)
+ """
+ f = F("foo")
+ g = deepcopy(f)
+ self.assertEqual(f.name, g.name)