  
      def test_parent_child_one_to_one_link_on_nonrelated_objects(self):
          # This won't work because the Demon Dogs restaurant is not an Italian
          # restaurant.
          self.assertRaises(
              ItalianRestaurant.DoesNotExist,
              lambda: Place.objects.get(name="Demon Dogs").restaurant.italianrestaurant
          )
  
      def test_inherited_does_not_exist_exception(self):
          # An ItalianRestaurant which does not exist is also a Place which does
          # not exist.
          self.assertRaises(
 
</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(
            Restaurant.DoesNotExist, lambda: p.restaurant
        )
 </s> add         with self.assertRaises(Restaurant.DoesNotExist):
            p.restaurant </s> remove         self.assertRaises(
            Place.MultipleObjectsReturned,
            Restaurant.objects.get, id__lt=12321
        )
 </s> add         with self.assertRaises(Place.MultipleObjectsReturned):
            Restaurant.objects.get(id__lt=12321) </s> remove         self.assertRaises(
            ObjectDoesNotExist,
            Article.objects.get,
            pub_date__year=2005,
            pub_date__month=8,
        )
 </s> add         with self.assertRaises(ObjectDoesNotExist):
            Article.objects.get(pub_date__year=2005, pub_date__month=8) </s> remove         self.assertRaises(FieldError, test_gmbh.save)
 </s> add         with self.assertRaises(FieldError):
            test_gmbh.save()
        with self.assertRaises(ItalianRestaurant.DoesNotExist):
            Place.objects.get(name="Demon Dogs").restaurant.italianrestaurant
  
      def test_parent_child_one_to_one_link_on_nonrelated_objects(self):
          # This won't work because the Demon Dogs restaurant is not an Italian
          # restaurant.
        with self.assertRaises(ItalianRestaurant.DoesNotExist):
            Place.objects.get(name="Demon Dogs").restaurant.italianrestaurant
        with self.assertRaises(ItalianRestaurant.DoesNotExist):
            Place.objects.get(name="Demon Dogs").restaurant.italianrestaurant
        with self.assertRaises(ItalianRestaurant.DoesNotExist):
            Place.objects.get(name="Demon Dogs").restaurant.italianrestaurant
        with self.assertRaises(ItalianRestaurant.DoesNotExist):
            Place.objects.get(name="Demon Dogs").restaurant.italianrestaurant
  
      def test_inherited_does_not_exist_exception(self):
          # An ItalianRestaurant which does not exist is also a Place which does
          # not exist.
          self.assertRaises(
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