def test_search_fields_must_be_provided(post_model):
"""Ensure that search fields need to be set."""
# Nothing is defined to search on, so error out
with pytest.raises(AttributeError):
post_model.search('hello')
# If fields are provided, return a query
assert isinstance(post_model.search('hello', fields=('body',)),
peewee.SelectQuery)
评论列表
文章目录