mirror of
				https://github.com/django/django.git
				synced 2025-10-31 01:25:32 +00:00 
			
		
		
		
	Refs #32508 -- Raised Type/ValueError instead of using "assert" in django.db.models.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
This commit is contained in:
		
				
					committed by
					
						 Mariusz Felisiak
						Mariusz Felisiak
					
				
			
			
				
	
			
			
			
						parent
						
							08f0778885
						
					
				
				
					commit
					f479df7f8d
				
			| @@ -87,9 +87,14 @@ class DistinctOnTests(TestCase): | ||||
|             self.assertSequenceEqual(qset, expected) | ||||
|             self.assertEqual(qset.count(), len(expected)) | ||||
|  | ||||
|         # Combining queries with different distinct_fields is not allowed. | ||||
|         # Combining queries with non-unique query is not allowed. | ||||
|         base_qs = Celebrity.objects.all() | ||||
|         with self.assertRaisesMessage(AssertionError, "Cannot combine queries with different distinct fields."): | ||||
|         msg = 'Cannot combine a unique query with a non-unique query.' | ||||
|         with self.assertRaisesMessage(TypeError, msg): | ||||
|             base_qs.distinct('id') & base_qs | ||||
|         # Combining queries with different distinct_fields is not allowed. | ||||
|         msg = 'Cannot combine queries with different distinct fields.' | ||||
|         with self.assertRaisesMessage(TypeError, msg): | ||||
|             base_qs.distinct('id') & base_qs.distinct('name') | ||||
|  | ||||
|         # Test join unreffing | ||||
|   | ||||
		Reference in New Issue
	
	Block a user