1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

[1.7.x] Fixed #23492 -- Restored F.__deepcopy__.

This reverts commit 3a66035107.
A regression test was also added.

Backport of d63ac5b595 from master.
This commit is contained in:
Baptiste Mispelon
2014-09-16 12:17:33 +02:00
parent 68ab3b1ac1
commit 04e7c7d51f
2 changed files with 15 additions and 0 deletions

View File

@@ -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)