Ejemplo n.º 1
0
 def test_process_books(self):
     converters = [pipe_to_book, slash_to_book, csv_to_book]
     file_parse_info = zip(get_input_files(), ["|", "/", ","], converters)
     books = get_books_from_files(file_parse_info)
     self.assertEquals(len(process_books(books, "", False, False)), 9)
     books = get_books_from_files(file_parse_info)
     self.assertEquals(process_books(books, None, False, False)[0],
                       Book("Kent", "Beck", "Implementation Patterns",
                            "2007"))
     books = get_books_from_files(file_parse_info)
     self.assertEquals(process_books(books, None, False, True)[-1],
                       Book("Kent", "Beck", "Implementation Patterns",
                            "2007"))
     books = get_books_from_files(file_parse_info)
     self.assertEquals(process_books(books, None, True, False)[0],
                       Book("Fred", "Brooks", "The Mythical Man-Month",
                            "1975"))
Ejemplo n.º 2
0
 def test_get_books_from_files(self):
     parse_info = zip(get_input_files(), ["|", "/", ","],
                      [pipe_to_book, slash_to_book, csv_to_book])
     self.assertEquals(len(list(get_books_from_files(parse_info))), 9)