          )
  
      def test_inherited_multiple_objects_returned_exception(self):
          # MultipleObjectsReturned is also inherited.
          self.assertRaises(
              Place.MultipleObjectsReturned,
              Restaurant.objects.get, id__lt=12321
          )
  
      def test_related_objects_for_inherited_models(self):
          # Related objects work just as they normally do.
          s1 = Supplier.objects.create(name="Joe's Chickens", address="123 Sesame St")
          s1.customers .set([self.restaurant, self.italian_restaurant])
 
</s> remove         self.assertRaises(
            Place.DoesNotExist,
            ItalianRestaurant.objects.get, name="The Noodle Void"
        )
 </s> add         with self.assertRaises(Place.DoesNotExist):
            ItalianRestaurant.objects.get(name="The Noodle Void") </s> remove         self.assertRaises(
            ItalianRestaurant.DoesNotExist,
            lambda: Place.objects.get(name="Demon Dogs").restaurant.italianrestaurant
        )
 </s> add         with self.assertRaises(ItalianRestaurant.DoesNotExist):
            Place.objects.get(name="Demon Dogs").restaurant.italianrestaurant </s> remove         self.assertRaises(
            DatabaseError,
            lambda: list(Thing.objects.all()),
        )
 </s> add         with self.assertRaises(DatabaseError):
            list(Thing.objects.all()) </s> remove         self.assertRaises(
            FieldError,
            lambda: Book.objects.all().aggregate(num_authors=Count('foo'))
        )
 </s> add         with self.assertRaises(FieldError):
            Book.objects.all().aggregate(num_authors=Count('foo')) </s> remove         self.assertRaises(
            Restaurant.DoesNotExist, lambda: p.restaurant
        )
 </s> add         with self.assertRaises(Restaurant.DoesNotExist):
            p.restaurant
        with self.assertRaises(Place.MultipleObjectsReturned):
            Restaurant.objects.get(id__lt=12321)
          )
  
      def test_inherited_multiple_objects_returned_exception(self):
          # MultipleObjectsReturned is also inherited.
        with self.assertRaises(Place.MultipleObjectsReturned):
            Restaurant.objects.get(id__lt=12321)
        with self.assertRaises(Place.MultipleObjectsReturned):
            Restaurant.objects.get(id__lt=12321)
        with self.assertRaises(Place.MultipleObjectsReturned):
            Restaurant.objects.get(id__lt=12321)
        with self.assertRaises(Place.MultipleObjectsReturned):
            Restaurant.objects.get(id__lt=12321)
  
      def test_related_objects_for_inherited_models(self):
          # Related objects work just as they normally do.
          s1 = Supplier.objects.create(name="Joe's Chickens", address="123 Sesame St")
          s1.customers .set([self.restaurant, self.italian_restaurant])
keep keep keep keep replace replace replace replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/model_inheritance/tests.py