          # Clean up that table
          with connection.schema_editor() as editor:
              editor.delete_model(Author)
          # Check that it's gone
          self.assertRaises(
              DatabaseError,
              lambda: list(Author.objects.all()),
          )
  
      @skipUnlessDBFeature('supports_foreign_keys')
      def test_fk(self):
          "Tests that creating tables out of FK order, then repointing, works"
          # Create the table
 
</s> remove         self.assertRaises(
            DatabaseError,
            lambda: list(Thing.objects.all()),
        )
 </s> add         with self.assertRaises(DatabaseError):
            list(Thing.objects.all()) </s> remove         self.assertRaises(DatabaseError, self.column_classes, new_field.remote_field.through)
 </s> add         with self.assertRaises(DatabaseError):
            self.column_classes(new_field.remote_field.through) </s> remove         self.assertRaises(DatabaseError, self.column_classes, new_field.remote_field.through)
 </s> add         with self.assertRaises(DatabaseError):
            self.column_classes(new_field.remote_field.through) </s> remove         self.assertRaises(
            DatabaseError,
            self.column_classes, LocalBookWithM2M._meta.get_field("tags").remote_field.through
        )
 </s> add         with self.assertRaises(DatabaseError):
            self.column_classes(LocalBookWithM2M._meta.get_field("tags").remote_field.through) </s> remove         self.assertRaises(AttributeError, lambda: CommonInfo.objects.all())
 </s> add         with self.assertRaises(AttributeError):
            CommonInfo.objects.all()
        with self.assertRaises(DatabaseError):
            list(Author.objects.all())
          # Clean up that table
          with connection.schema_editor() as editor:
              editor.delete_model(Author)
          # Check that it's gone
        with self.assertRaises(DatabaseError):
            list(Author.objects.all())
        with self.assertRaises(DatabaseError):
            list(Author.objects.all())
        with self.assertRaises(DatabaseError):
            list(Author.objects.all())
        with self.assertRaises(DatabaseError):
            list(Author.objects.all())
  
      @skipUnlessDBFeature('supports_foreign_keys')
      def test_fk(self):
          "Tests that creating tables out of FK order, then repointing, works"
          # Create the table
keep keep keep keep replace replace replace replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/schema/tests.py