diff --git a/tests/queryset_pickle/tests.py b/tests/queryset_pickle/tests.py index 63f4283870..3e038b0c51 100644 --- a/tests/queryset_pickle/tests.py +++ b/tests/queryset_pickle/tests.py @@ -5,6 +5,7 @@ import pickle import unittest import warnings +from django.db import models from django.test import TestCase from django.utils import six from django.utils.encoding import force_text @@ -130,6 +131,11 @@ class PickleabilityTestCase(TestCase): m2ms = pickle.loads(pickle.dumps(m2ms)) self.assertQuerysetEqual(m2ms, [m2m], lambda x: x) + def test_annotation_with_callable_default(self): + # Happening.when has a callable default of datetime.datetime.now. + qs = Happening.objects.annotate(latest_time=models.Max('when')) + self.assert_pickles(qs) + def test_missing_django_version_unpickling(self): """ #21430 -- Verifies a warning is raised for querysets that are