mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Refs #32548 -- Added tests for passing conditional expressions to Q().
This commit is contained in:
		| @@ -172,6 +172,17 @@ class PickleabilityTestCase(TestCase): | ||||
|         m2ms = pickle.loads(pickle.dumps(m2ms)) | ||||
|         self.assertSequenceEqual(m2ms, [m2m]) | ||||
|  | ||||
|     def test_pickle_boolean_expression_in_Q__queryset(self): | ||||
|         group = Group.objects.create(name='group') | ||||
|         Event.objects.create(title='event', group=group) | ||||
|         groups = Group.objects.filter( | ||||
|             models.Q(models.Exists( | ||||
|                 Event.objects.filter(group_id=models.OuterRef('id')), | ||||
|             )), | ||||
|         ) | ||||
|         groups2 = pickle.loads(pickle.dumps(groups)) | ||||
|         self.assertSequenceEqual(groups2, [group]) | ||||
|  | ||||
|     def test_pickle_exists_queryset_still_usable(self): | ||||
|         group = Group.objects.create(name='group') | ||||
|         Event.objects.create(title='event', group=group) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user