      def message(self):
          return '%s was rendered.' % self.template_name
  
  
  class _DatabaseFailure:
      def __init__(self, wrapped, message):
          self.wrapped = wrapped
          self.message = message
 
</s> remove         raise AssertionError(self.message)
 </s> add         raise DatabaseOperationForbidden(self.message) </s> remove         with self.assertRaisesMessage(AssertionError, message):
 </s> add         with self.assertRaisesMessage(DatabaseOperationForbidden, message): </s> remove         with self.assertRaisesMessage(AssertionError, message):
 </s> add         with self.assertRaisesMessage(DatabaseOperationForbidden, message): </s> remove         with self.assertRaisesMessage(AssertionError, expected_message):
 </s> add         with self.assertRaisesMessage(DatabaseOperationForbidden, expected_message): </s> remove         with self.assertRaisesMessage(AssertionError, expected_message):
 </s> add         with self.assertRaisesMessage(DatabaseOperationForbidden, expected_message):
class DatabaseOperationForbidden(AssertionError):
    pass


      def message(self):
          return '%s was rendered.' % self.template_name
  
  
class DatabaseOperationForbidden(AssertionError):
    pass


  class _DatabaseFailure:
      def __init__(self, wrapped, message):
          self.wrapped = wrapped
          self.message = message
keep keep keep add keep keep keep keep
 Fixed #33278 -- Improved error for connection/query attempts against disallowed databases in tests. 
django/test/testcases.py