  
      @override_settings(AUTH_USER_MODEL='badsetting')
      def test_swappable_user_bad_setting(self):
          "The alternate user setting must point to something in the format app.model"
          with self.assertRaises(ImproperlyConfigured):
              get_user_model()
  
      @override_settings(AUTH_USER_MODEL='thismodel.doesntexist')
      def test_swappable_user_nonexistent_model(self):
          "The current user model must point to an installed model"
 
</s> remove         with self.assertRaises(ImproperlyConfigured):
 </s> add         msg = (
            "AUTH_USER_MODEL refers to model 'thismodel.doesntexist' "
            "that has not been installed"
        )
        with self.assertRaisesMessage(ImproperlyConfigured, msg): </s> remove         with self.assertRaises(ImproperlyConfigured):
 </s> add         msg = "'apps.apps.BadConfig' must supply a name attribute."
        with self.assertRaisesMessage(ImproperlyConfigured, msg): </s> remove         with self.assertRaises(ValueError):
 </s> add         msg = "The annotation 'age' conflicts with a field on the model."
        with self.assertRaisesMessage(ValueError, msg): </s> remove         with self.assertRaises(ValueError):
 </s> add         msg = "The annotation 'friends' conflicts with a field on the model."
        with self.assertRaisesMessage(ValueError, msg): </s> remove         with self.assertRaises(ImproperlyConfigured):
 </s> add         msg = (
            "TemplateResponseMixin requires either a definition of "
            "'template_name' or an implementation of 'get_template_names()'"
        )
        with self.assertRaisesMessage(ImproperlyConfigured, msg):
        msg = "AUTH_USER_MODEL must be of the form 'app_label.model_name'"
        with self.assertRaisesMessage(ImproperlyConfigured, msg):
  
      @override_settings(AUTH_USER_MODEL='badsetting')
      def test_swappable_user_bad_setting(self):
          "The alternate user setting must point to something in the format app.model"
        msg = "AUTH_USER_MODEL must be of the form 'app_label.model_name'"
        with self.assertRaisesMessage(ImproperlyConfigured, msg):
              get_user_model()
  
      @override_settings(AUTH_USER_MODEL='thismodel.doesntexist')
      def test_swappable_user_nonexistent_model(self):
          "The current user model must point to an installed model"
keep keep keep keep replace keep keep keep keep keep
 Used assertRaisesMessage() to test Django's error messages. 
tests/auth_tests/test_basic.py