Ticket #13328: 13328_test.diff
File 13328_test.diff, 1.5 KB (added by , 15 years ago) |
---|
-
tests/regressiontests/queryset_pickle/tests.py
1 1 import pickle 2 import datetime 2 3 3 4 from django.test import TestCase 4 5 5 from models import Group, Event 6 from models import Group, Event, Happening 6 7 7 8 8 class PickleabilityTestCase(TestCase): 9 9 def assert_pickles(self, qs): 10 10 self.assertEqual(list(pickle.loads(pickle.dumps(qs))), list(qs)) … … 12 12 def test_related_field(self): 13 13 g = Group.objects.create(name="Ponies Who Own Maybachs") 14 14 self.assert_pickles(Event.objects.filter(group=g.id)) 15 16 def test_datetime_callable_default_all(self): 17 self.assert_pickles(Happening.objects.all()) 18 19 def test_datetime_callable_default_filter(self): 20 self.assert_pickles(Happening.objects.filter(when=datetime.datetime.now())) 21 -
tests/regressiontests/queryset_pickle/models.py
1 import datetime 1 2 from django.db import models 2 3 from django.utils.translation import ugettext_lazy as _ 3 4 … … 6 7 7 8 class Event(models.Model): 8 9 group = models.ForeignKey(Group) 10 11 class Happening(models.Model): 12 when = models.DateTimeField(blank=True, default=datetime.datetime.now)