          )
  
      def test_prevent_double_registration(self):
          self.site.register(Person)
          self.assertRaises(admin.sites.AlreadyRegistered,
                            self.site.register,
                            Person)
  
      def test_registration_with_star_star_options(self):
          self.site.register(Person, search_fields=['name'])
          self.assertEqual(self.site._registry[Person].search_fields, ['name'])
  
 
</s> remove         self.assertRaises(ImproperlyConfigured, self.site.register, Location)
 </s> add         with self.assertRaises(ImproperlyConfigured):
            self.site.register(Location) </s> remove         self.assertRaises(
            FieldError,
            lambda: Author.objects.filter(firstname__exact="John")
        )
 </s> add         with self.assertRaises(FieldError):
            Author.objects.filter(firstname__exact="John") </s> remove         self.assertRaises(
            TypeError,
            Article.objects.dates,
        )
 </s> add         with self.assertRaises(TypeError):
            Article.objects.dates() </s> remove         self.assertRaises(
            TypeError,
            Species.objects.select_related,
            'genus__family__order', depth=4
        )
 </s> add         with self.assertRaises(TypeError):
            Species.objects.select_related('genus__family__order', depth=4) </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'))
        with self.assertRaises(admin.sites.AlreadyRegistered):
            self.site.register(Person)
          )
  
      def test_prevent_double_registration(self):
          self.site.register(Person)
        with self.assertRaises(admin.sites.AlreadyRegistered):
            self.site.register(Person)
        with self.assertRaises(admin.sites.AlreadyRegistered):
            self.site.register(Person)
        with self.assertRaises(admin.sites.AlreadyRegistered):
            self.site.register(Person)
  
      def test_registration_with_star_star_options(self):
          self.site.register(Person, search_fields=['name'])
          self.assertEqual(self.site._registry[Person].search_fields, ['name'])
  
keep keep keep keep replace replace replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/admin_registration/tests.py