コード例 #1
0
ファイル: books_test.py プロジェクト: bertrandvidal/books
 def test_filter_books(self):
     slash_book = slash_to_book(["1993", "Steve", "McConnell",
                                 "Code Complete"])
     csv_book = csv_to_book(["Clean Code", "Martin", "Robert", "2008"])
     self.assertEquals(filter_books([slash_book, csv_book], "20"),
                       [csv_book])
     self.assertEquals(filter_books([slash_book, csv_book], "ode"),
                       [slash_book, csv_book])
     self.assertEquals(filter_books([slash_book, csv_book], None),
                       [slash_book, csv_book])
コード例 #2
0
ファイル: books_test.py プロジェクト: bertrandvidal/books
 def test_sort_books(self):
     slash_book = slash_to_book(["1993", "Steve", "McConnell",
                                 "Code Complete"])
     csv_book = csv_to_book(["Clean Code", "Martin", "Robert", "2008"])
     kent_book_1 = pipe_to_book(["Kent", "Beck", "Test-Driven Development",
                                 "2002"])
     kent_book_2 = pipe_to_book(["Kent", "Beck", "Implementation Patterns",
                                "2007"])
     books = [slash_book, kent_book_1, kent_book_2, csv_book]
     random.shuffle(books)
     self.assertEquals(sort_books(books), [kent_book_2, kent_book_1,
                                           csv_book, slash_book])
     self.assertEquals(sort_books(books, True), [slash_book, kent_book_1,
                                                 kent_book_2,csv_book])
     self.assertEquals(sort_books(books, True, True), [csv_book,
                                                       kent_book_2,
                                                       kent_book_1,
                                                       slash_book])
コード例 #3
0
ファイル: books_test.py プロジェクト: bertrandvidal/books
 def test_book_repr(self):
     slash_book = slash_to_book(["2002", "Martin", "Fowler",
                                 "Patterns of Enterprise Application Architecture"])
     self.assertEquals(str(slash_book), "Fowler, Martin, Patterns of Enterprise Application Architecture, 2002")
コード例 #4
0
ファイル: books_test.py プロジェクト: bertrandvidal/books
 def test_slash_conversion(self):
     slash_book = slash_to_book(["1993", "Steve", "McConnell",
                                 "Code Complete"])
     self._assert_book_conversion(slash_book, ["Steve", "McConnell",
                                               "Code Complete", "1993"])