Example #1
0
 def test21_filter_success(self):
     book_collection = BookCollection(**self.valid_bookcoll_kwargs)
     book_collection[self.test_book1.isbn] = self.test_book1
     book_collection[self.test_book2.isbn] = self.test_book2
     self.assertEqual(
         book_collection.filter(key='isbn')[0], self.test_book1)
     self.assertEqual(
         book_collection.filter(key='genre')[0], self.test_book2)
Example #2
0
 def test22_filter_attr_not_found_fail(self):
     book_collection = BookCollection(**self.valid_bookcoll_kwargs)
     book_collection[self.test_book1.isbn] = self.test_book1
     with self.assertRaises(KeyError):
         book_collection.filter(key='invalid')