Beispiel #1
0
 def test_sort(self):
     books = RentalBooks([])
     books.append(RentalBook("test3", "2017/01/05", True, "hoge"))
     books.append(RentalBook("test1", "2017/01/03", True, "hoge"))
     book = RentalBook("test1", "2017/01/02", True, "hoge")
     books.append(book)
     books.apply_filter(RentalBookExpireFilter(xdays="5"))
     assert books.len == 3
     assert books.get(0) == book  # メモリ比較
Beispiel #2
0
 def test_filter_to_rental_books_expired(self):
     books = RentalBooks([])
     book = RentalBook("test1", "2017/01/01", True, "hoge")
     books.append(book)
     books.append(RentalBook("test2", "9999/01/02", True, "hoge"))
     books.append(RentalBook("test3", "9999/01/07", True, "hoge"))
     books.apply_filter(RentalBookExpiredFilter())
     assert books.len == 1
     assert books.get(0) == book  # メモリ比較
Beispiel #3
0
 def test_get_expire_text_from_today(self, delta, expected_text):
     d = date.today() + timedelta(days=delta)
     book = RentalBook("test", d.strftime("%Y/%m/%d"), True, "hoge")
     assert book.get_expire_text_from_today() == expected_text
Beispiel #4
0
 def test_is_expire_in_xdays(self, delta, xdays, result):
     d = date.today() + timedelta(days=delta)
     book = RentalBook("test", d.strftime("%Y/%m/%d"), True, "hoge")
     assert book.is_expire_in_xdays(xdays) is result
Beispiel #5
0
 def test_is_expired_false(self):
     book = RentalBook("test", "9999/01/1", False, "hoge")
     assert book.is_expired() is False
Beispiel #6
0
 def test_is_expired_true(self):
     book = RentalBook("test", "2017/01/01", True, "hoge")
     assert book.is_expired()
Beispiel #7
0
 def test_basic(self):
     books = RentalBooks([])
     books.append(RentalBook("test1", "2017/01/01", True, "hoge"))
     books.append(RentalBook("test2", "9999/01/02", True, "hoge"))
     assert books.len == 2