示例#1
0
 def test_show_books_list(self, mock_print):
     bk1 = Book('a', 'aaa')
     bk2 = Book('b', 'bbb')
     books = [bk1, bk2]
     ui.show_books(books)
     mock_print.assert_any_call(bk1)
     mock_print.assert_any_call(bk2)
示例#2
0
def search_book():
    # while true:
    search_term = ui.ask_question(
        'Enter search term, will match partial authors or titles.')
    # if(not search_term):
    #     print("You cannot enter in a blank string")
    # else:
    #     break
    matches = store.book_search(search_term)
    ui.show_books(matches)
示例#3
0
def search_book():

    search_term = ui.ask_question(
        'Enter search term, will match partial authors or titles.')
    if search_term == None:

        print('Nothing was entered try again')

    else:
        matches = store.book_search(search_term)
        ui.show_books(matches)
示例#4
0
 def test_show_books_empty(self, mock_print):
     books = []
     ui.show_books(books)
     mock_print.assert_called_with('No books to display')
示例#5
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)
示例#6
0
def show_all_books():
    books = store.get_all_books()
    ui.show_books(books)
示例#7
0
def show_unread_books():
    unread_books = store.get_books_by_read_value(False)
    ui.show_books(unread_books)
示例#8
0
def show_read_books():
    read_books = store.get_books_by_read_value(True)
    ui.show_books(read_books)
示例#9
0
def delete_book():
    search_term = ui.ask_question('Enter book ID:   '   ) 
    matches = store.book_search(search_term)
    ui.show_books(matches) # Corrected "show_book" to "show_books"
示例#10
0
def search_book():
    """ searches book in the database then displays it"""
    search_term = ui.ask_question(
        'Enter search term, will match partial authors or titles.')
    matches = store.book_search(search_term)
    ui.show_books(matches)
示例#11
0
def show_all_books():
    """ gets all the books in the database then displays it"""
    books = store.get_all_books()
    ui.show_books(books)
示例#12
0
def show_unread_books():
    """ lists unread books"""
    unread_books = store.get_books_by_read_value(False)
    ui.show_books(unread_books)
示例#13
0
def show_read_books():
    """ lists books that are read"""
    read_books = store.get_books_by_read_value(True)
    ui.show_books(read_books)