mirror of
https://github.com/django/django.git
synced 2024-12-26 19:16:11 +00:00
ff963358d7
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12579 bcc190cf-cafb-0310-a4f2-bffc1f526a37
22 lines
607 B
Python
22 lines
607 B
Python
from django.test import TestCase
|
|
|
|
from models import DataModel
|
|
|
|
|
|
class CustomField(TestCase):
|
|
def test_defer(self):
|
|
d = DataModel.objects.create(data=[1, 2, 3])
|
|
|
|
self.assertTrue(isinstance(d.data, list))
|
|
|
|
d = DataModel.objects.get(pk=d.pk)
|
|
self.assertTrue(isinstance(d.data, list))
|
|
self.assertEqual(d.data, [1, 2, 3])
|
|
|
|
d = DataModel.objects.defer("data").get(pk=d.pk)
|
|
d.save()
|
|
|
|
d = DataModel.objects.get(pk=d.pk)
|
|
self.assertTrue(isinstance(d.data, list))
|
|
self.assertEqual(d.data, [1, 2, 3])
|