Exemplo n.º 1
0
 def __init__(self, **kwargs):
     """
     main application build
     """
     super().__init__(**kwargs)
     self.list_books = BookList()
     self.list_books.load_file()
Exemplo n.º 2
0
    def build(self):  # Create the main widget for Kivy program
        self.booklist = BookList()
        self.booklist.load_books()

        self.title = "Reading List 2.0"  # Kivy title
        self.root = Builder.load_file("app.kv")  # load Kivy
        self.loading()  # load the books
        return self.root
Exemplo n.º 3
0
    def __init__(self, **kwargs):
        kwargs['cols'] = 1
        super(BookListPanel, self).__init__(**kwargs)
        self.book_list = BookList('books.csv')
        self.book_list_adapter = ListAdapter(data=[],
                                             args_converter=self.book_convert,
                                             cls=ListItemButton,
                                             selection_mode='single',
                                             allow_empty_selection=False)

        self.refresh_books(completed=False)
Exemplo n.º 4
0
 def searchBook(self, bookName):
     # 本を探す
     book_list = BookList()
     location = book_list.searchBook(bookName)
     # 本の場所がnullではない(所蔵してる)とき
     if location is not None:
         # 貸出中かチェックする
         lending_list = LendingList()
         if lending_list.check(bookName):
             # 貸出中のとき
             return "貸出中です"
         else:
             # 貸出中ではないとき
             return location
     # 所蔵してないとき
     else:
         return "その本は所蔵していません"
from booklist import BookList
from book import Book

# test empty BookList
book_list = BookList()
print(book_list)
assert len(book_list.books) == 0

# test loading books
book_list.load_books('books.csv')
print(book_list)
assert len(book_list.books) > 0  # assuming CSV file is not empty

# test sorting books

# test adding a new Book

# test saving books (check CSV file manually to see results)
Exemplo n.º 6
0
def main():
    my_books = BookList()

    print(my_books)
Exemplo n.º 7
0
"""
(incomplete) Tests for BookList class
"""
from booklist import BookList
from book import Book

books = BookList()

# test empty BookList
print(books)
assert len(books.book_list) == 0

# test loading books
books.load_books()
print(books)
assert len(books.book_list) > 0  # assuming CSV file is not empty

# test adding a new Book
books.add_book('In Search of Lost Time', 'Marcel Proust', 365)
print(books)
assert len(books.book_list) >= 0

# test saving books (check CSV file manually to see results)
books.save_books()
assert len(books.book_list) > 0

# test get book by title function
book = books.get_book_title('The Practice of Computing Using Python')
print(book)

# test total number of pages for required
Exemplo n.º 8
0
 def __init__(self):
     super(ReadingListApp, self).__init__()
     self.book_list = BookList()
     self.top_status_bar = Label(id="top_status_bar", text="total pages", size_hint_y=None, height=50)
     self.bottom_status_bar = Label(id="bottom_status_bar", text="click books to mark them as complete",
                                    size_hint_y=None, height=50)
Exemplo n.º 9
0
 def __init__(self, books_filename, authors_filename, books_authors_link_filename):
     self.all_books = BookList(books_filename)
     self.all_authors = AuthorList(authors_filename)
     self.all_book_author_links = BookAuthorLinkList(books_authors_link_filename)
     pass
Exemplo n.º 10
0
from book import Book
from booklist import BookList

# test empty book (defaults)
book = Book("", "", 0, 'r')
print(book)
assert book.author == ""
assert book.title == ""
assert book.pages == 0

# test initial-value book
book2 = Book("Fish fingers", "Dory", 2, 'r')

# test mark_completed()
book2.mark()
assert book2.flag == 'c'

bl = BookList()
bl.add_book(book2)
assert len(bl.completelist) == 1
book3 = Book("Simple", 'Hegns', 100, 'r')
bl.add_book(book3)
assert len(bl.requirelist) == 1
bl.complete_book(book3)
assert len(bl.completelist) == 2

print("all tests passed!")