@@ -90,7 +90,9 @@ def setUpTestData(cls):
90
90
Product (pk = 6 , sku = "66" , size = 5 , colour = "blue" , shape = "square" ),
91
91
Product (pk = 7 , sku = "77" , size = 1 , colour = "yellow" , shape = "circle" ),
92
92
Product (pk = 8 , sku = "88" , size = 2 , colour = "green" , shape = "triangle" ),
93
- Product (pk = 9 , sku = "99" , size = 2 , colour = "red" , shape = "square" ),
93
+ Product (
94
+ pk = 9 , sku = "99" , size = 2 , colour = "red" , shape = "square" , deleted = True
95
+ ),
94
96
]
95
97
)
96
98
@@ -366,7 +368,7 @@ def test_not_nullable(self):
366
368
item = CartItem .objects .create (
367
369
pk = 4 ,
368
370
product_code = "nonexistent" ,
369
- description = "cart item for anonexistent product" ,
371
+ description = "cart item for a non-existent product" ,
370
372
)
371
373
with self .assertRaises (Product .DoesNotExist ):
372
374
item .product
@@ -382,3 +384,13 @@ def test_descriptor_not_cached(self):
382
384
item .product .delete ()
383
385
with self .assertRaises (Product .DoesNotExist ):
384
386
item .product
387
+
388
+ def test_primitive_in_predicate (self ):
389
+ product = Product .objects .filter (deleted = True ).first ()
390
+ item = CartItem .objects .create (
391
+ pk = 5 ,
392
+ product_code = product .sku ,
393
+ description = "cart item for a deleted product" ,
394
+ )
395
+ with self .assertRaises (Product .DoesNotExist ):
396
+ item .product
0 commit comments