diff --git a/tests/queryset_pickle/tests.py b/tests/queryset_pickle/tests.py
index a58e45caed..16884d550d 100644
a
|
b
|
from .models import Container, Event, Group, Happening, M2MModel, MyEvent
|
11 | 11 | class PickleabilityTestCase(TestCase): |
12 | 12 | @classmethod |
13 | 13 | def setUpTestData(cls): |
14 | | Happening.objects.create() # make sure the defaults are working (#20158) |
| 14 | cls.happening = Happening.objects.create() # make sure the defaults are working (#20158) |
15 | 15 | |
16 | 16 | def assert_pickles(self, qs): |
17 | 17 | self.assertEqual(list(pickle.loads(pickle.dumps(qs))), list(qs)) |
… |
… |
class PickleabilityTestCase(TestCase):
|
224 | 224 | qs = Happening.objects.annotate(latest_time=models.Max('when')) |
225 | 225 | self.assert_pickles(qs) |
226 | 226 | |
| 227 | def test_annotation_values(self): |
| 228 | qs = Happening.objects.values('name').annotate(latest_time=models.Max('when')) |
| 229 | restored_qs = Happening.objects.all() |
| 230 | restored_qs.query = pickle.loads(pickle.dumps(qs.query)) |
| 231 | self.assertEqual( |
| 232 | restored_qs.first(), |
| 233 | {'name': 'test', 'latest_time': self.happening.when}, |
| 234 | ) |
| 235 | |
227 | 236 | def test_filter_deferred(self): |
228 | 237 | qs = Happening.objects.all() |
229 | 238 | qs._defer_next_filter = True |