          )
  
          # The Post model doesn't have an attribute called
          # 'attached_%(class)s_set'.
          self.assertRaises(
              AttributeError, getattr, post, "attached_%(class)s_set"
          )
  
      def test_model_with_distinct_related_query_name(self):
          self.assertQuerysetEqual(Post.objects.filter(attached_model_inheritance_comments__is_spam=True), [])
  
          # The Post model doesn't have a related query accessor based on
 
</s> remove         self.assertRaises(FieldError, Restaurant.objects.filter, supplier__name="foo")
 </s> add         with self.assertRaises(FieldError):
            Restaurant.objects.filter(supplier__name="foo") </s> remove             self.assertRaises(Director.DoesNotExist, lambda: private_school.director)
 </s> add             with self.assertRaises(Director.DoesNotExist):
                private_school.director </s> remove         self.assertRaises(AssertionError, Person.objects.latest)
 </s> add         with self.assertRaises(AssertionError):
            Person.objects.latest() </s> remove         self.assertRaises(
            ValueError,
            Book.objects.all().annotate,
            Avg('authors__age'), authors__age__avg=Avg('authors__age')
        )
 </s> add         with self.assertRaises(ValueError):
            Book.objects.all().annotate(Avg('authors__age'), authors__age__avg=Avg('authors__age')) </s> remove         self.assertRaises(ImportError, import_module,
            'utils_tests.test_no_submodule.anything')
 </s> add         with self.assertRaises(ImportError):
            import_module('utils_tests.test_no_submodule.anything')
        with self.assertRaises(AttributeError):
            getattr(post, "attached_%(class)s_set")
          )
  
          # The Post model doesn't have an attribute called
          # 'attached_%(class)s_set'.
        with self.assertRaises(AttributeError):
            getattr(post, "attached_%(class)s_set")
        with self.assertRaises(AttributeError):
            getattr(post, "attached_%(class)s_set")
        with self.assertRaises(AttributeError):
            getattr(post, "attached_%(class)s_set")
  
      def test_model_with_distinct_related_query_name(self):
          self.assertQuerysetEqual(Post.objects.filter(attached_model_inheritance_comments__is_spam=True), [])
  
          # The Post model doesn't have a related query accessor based on
keep keep keep keep replace replace replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/model_inheritance/tests.py