          connections.databases['tz'] = connections.databases['default'].copy()
          connections.databases['tz']['TIME_ZONE'] = 'Asia/Bangkok'
          tz_conn = connections['tz']
          try:
              with self.assertRaises(ImproperlyConfigured):
                  tz_conn.cursor()
          finally:
              connections['tz'].close()       # in case the test fails
              del connections['tz']
              del connections.databases['tz']
 
</s> remove             with self.assertRaises(transaction.TransactionManagementError):
 </s> add             msg = 'on_commit() cannot be used in manual transaction management'
            with self.assertRaisesMessage(transaction.TransactionManagementError, msg): </s> remove             with self.assertRaises(DatabaseError):
 </s> add             msg = (
                "An error occurred in the current transaction. You can't "
                "execute queries until the end of the 'atomic' block."
            )
            with self.assertRaisesMessage(DatabaseError, msg): </s> remove             with self.assertRaises(FieldError):
 </s> add             msg = "Unsupported lookup 'junk' for IntegerField or join on the field not permitted."
            with self.assertRaisesMessage(FieldError, msg): </s> remove             with self.assertRaises(FieldError):
 </s> add             with self.assertRaisesMessage(FieldError, msg): </s> remove         with self.assertRaises(ImproperlyConfigured):
 </s> add         msg = (
            'AuthorList is missing a QuerySet. Define AuthorList.model, '
            'AuthorList.queryset, or override AuthorList.get_queryset().'
        )
        with self.assertRaisesMessage(ImproperlyConfigured, msg):
            msg = (
                "Connection 'tz' cannot set TIME_ZONE because its engine "
                "handles time zones conversions natively."
            )
            with self.assertRaisesMessage(ImproperlyConfigured, msg):
          connections.databases['tz'] = connections.databases['default'].copy()
          connections.databases['tz']['TIME_ZONE'] = 'Asia/Bangkok'
          tz_conn = connections['tz']
          try:
            msg = (
                "Connection 'tz' cannot set TIME_ZONE because its engine "
                "handles time zones conversions natively."
            )
            with self.assertRaisesMessage(ImproperlyConfigured, msg):
                  tz_conn.cursor()
          finally:
              connections['tz'].close()       # in case the test fails
              del connections['tz']
              del connections.databases['tz']
keep keep keep keep replace keep keep keep keep keep
 Used assertRaisesMessage() to test Django's error messages. 
tests/timezones/tests.py