                  self.assertTrue(FakeQuerySet.called)
              # This is not wanted behavior, but this is how Django has always
              # behaved for databases that do not return correct information
              # about matched rows for UPDATE.
              with self.assertRaises(DatabaseError):
                  asos.save(force_update=True)
              with self.assertRaises(DatabaseError):
                  asos.save(update_fields=['pub_date'])
          finally:
              Article._base_manager._queryset_class = orig_class
 
</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(DatabaseError):
 </s> add         with self.assertRaisesMessage(DatabaseError, 'Forced update did not affect any rows.'): </s> remove         with self.assertRaises(NotImplementedError):
 </s> add         msg = 'annotate() + distinct(fields) is not implemented.'
        with self.assertRaisesMessage(NotImplementedError, msg): </s> remove         with self.assertRaises(DatabaseError):
 </s> add         msg = 'Forced update did not affect any rows.'
        with self.assertRaisesMessage(DatabaseError, msg): </s> remove         with self.assertRaises(FieldError):
 </s> add         msg = 'Joined field references are not permitted in this query'
        with self.assertRaisesMessage(FieldError, msg):
            with self.assertRaisesMessage(DatabaseError, 'Forced update did not affect any rows.'):
                  self.assertTrue(FakeQuerySet.called)
              # This is not wanted behavior, but this is how Django has always
              # behaved for databases that do not return correct information
              # about matched rows for UPDATE.
            with self.assertRaisesMessage(DatabaseError, 'Forced update did not affect any rows.'):
                  asos.save(force_update=True)
              with self.assertRaises(DatabaseError):
                  asos.save(update_fields=['pub_date'])
          finally:
              Article._base_manager._queryset_class = orig_class
keep keep keep keep replace keep keep keep keep keep
 Used assertRaisesMessage() to test Django's error messages. 
tests/basic/tests.py