          self.assertIsInstance(self.site._registry[Person], NameAdmin)
  
      def test_prevent_double_registration(self):
          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'])
 
</s> remove         with self.assertRaises(ImproperlyConfigured):
 </s> add         msg = 'The model Location is abstract, so it cannot be registered with admin.'
        with self.assertRaisesMessage(ImproperlyConfigured, msg): </s> remove             with self.assertRaises(transaction.TransactionManagementError):
 </s> add             with self.assertRaisesMessage(transaction.TransactionManagementError, self.forbidden_atomic_msg): </s> remove             with self.assertRaises(transaction.TransactionManagementError):
 </s> add             with self.assertRaisesMessage(transaction.TransactionManagementError, self.forbidden_atomic_msg): </s> remove             with self.assertRaises(transaction.TransactionManagementError):
 </s> add             with self.assertRaisesMessage(transaction.TransactionManagementError, self.forbidden_atomic_msg): </s> remove             with self.assertRaises(NotImplementedError):
 </s> add             msg = 'Bilateral transformations on nested querysets are not supported.'
            with self.assertRaisesMessage(NotImplementedError, msg):
        msg = 'The model Person is already registered'
        with self.assertRaisesMessage(admin.sites.AlreadyRegistered, msg):
          self.assertIsInstance(self.site._registry[Person], NameAdmin)
  
      def test_prevent_double_registration(self):
          self.site.register(Person)
        msg = 'The model Person is already registered'
        with self.assertRaisesMessage(admin.sites.AlreadyRegistered, msg):
              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 keep keep keep keep keep
 Used assertRaisesMessage() to test Django's error messages. 
tests/admin_registration/tests.py