def test_search_book_case_insensitive_author_match(self):
     self.add_test_data()
     self.assertCountEqual([self.bk3], bookstore.book_search('cReAtOr'))
 def test_search_book_empty_store(self):
     self.clear_bookstore()
     self.assertEqual([], bookstore.book_search('No book here'))
 def test_search_book_case_insensitive_title_match(self):
     self.add_test_data()
     self.assertCountEqual([self.bk1, self.bk2],
                           bookstore.book_search('bOoK'))
 def test_search_book_not_found(self):
     self.add_test_data()
     self.assertEqual([], bookstore.book_search('Not in list'))
 def test_search_book_title_match(self):
     self.add_test_data()
     self.assertCountEqual([self.bk1, self.bk2],
                           bookstore.book_search('Book'))
 def test_search_book_author_match(self):
     self.add_test_data()
     self.assertCountEqual([self.bk1], bookstore.book_search('Ann'))
 def test_search_book_empty_store(self):
     self.clear_bookstore()
     self.assertListEqual([], store.book_search('Not in list'))
Esempio n. 8
0
def search_book():
    search_term = ui.ask_question('Enter search term, will match partial authors or titles.')
    matches = store.book_search(search_term)
    ui.show_books(matches)