def METHOD_NAME(self):
    with patch_search_fields(
        models.Book, models.Book.search_fields + [index.SearchField("foo")]
    ):
        expected_errors = [
            checks.Warning(
                "Book.search_fields contains non-existent field 'foo'",
                obj=models.Book,
                id="wagtailsearch.W004",
            )
        ]
        errors = models.Book.check()
        self.assertEqual(errors, expected_errors)