本文整理汇总了Python中search.Search.search_books方法的典型用法代码示例。如果您正苦于以下问题:Python Search.search_books方法的具体用法?Python Search.search_books怎么用?Python Search.search_books使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类search.Search
的用法示例。
在下文中一共展示了Search.search_books方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: BookSearchTests
# 需要导入模块: from search import Search [as 别名]
# 或者: from search.Search import search_books [as 别名]
class BookSearchTests(WLTestCase):
def setUp(self):
WLTestCase.setUp(self)
index = Index()
self.search = Search()
index.delete_query(self.search.index.query(uid="*"))
index.index.commit()
with self.settings(NO_SEARCH_INDEX=False):
self.do_doktora = Book.from_xml_file(
get_fixture('do-doktora.xml', opds))
self.do_anusie = Book.from_xml_file(
get_fixture('fraszka-do-anusie.xml', catalogue))
def test_search_perfect_book_author(self):
books = self.search.search_books(self.search.index.query(authors=u"sęp szarzyński"))
assert len(books) == 1
assert books[0].id == self.do_anusie.id
# here we lack slop functionality as well
def test_search_perfect_book_title(self):
books = self.search.search_books(self.search.index.query(title=u"fraszka do anusie"))
assert len(books) == 1
assert books[0].id == self.do_anusie.id