Example #1
0
def test_watchlist_size():
    watchlist = WatchList()
    assert watchlist.size() == 0
    movie1 = Movie("Moana", 2016)
    movie2 = Movie("Frozen", 2014)
    watchlist.add_movie(movie1)
    assert watchlist.size() == 1
    watchlist.add_movie(movie2)
    assert watchlist.size() == 2
    watchlist.remove_movie(movie1)
    assert watchlist.size() == 1
Example #2
0
def test_watchlist_select_movie_to_watch():
    watchlist = WatchList()
    movie1 = Movie("Moana", 2016)
    movie2 = Movie("Frozen", 2014)
    assert watchlist.select_movie_to_watch(0) is None
    watchlist.add_movie(movie1)
    assert watchlist.select_movie_to_watch(0) == movie1
    assert watchlist.select_movie_to_watch(1) is None
    watchlist.add_movie(movie2)
    assert watchlist.select_movie_to_watch(1) == movie2
    watchlist.remove_movie(movie1)
    assert watchlist.select_movie_to_watch(1) is None
    assert watchlist.select_movie_to_watch(0) == movie2
    assert watchlist.select_movie_to_watch("0") is None
    assert watchlist.select_movie_to_watch(-1) is None
Example #3
0
def test_watchlist_remove_movie():
    watchlist = WatchList()
    movie = Movie("Moana", 2016)
    watchlist.add_movie(movie)
    watchlist.remove_movie("")
    assert len(watchlist.watchlist) == 1
    watchlist.remove_movie(movie)
    assert len(watchlist.watchlist) == 0
    watchlist.remove_movie(movie)
    assert len(watchlist.watchlist) == 0
Example #4
0
def test_watch_list_add_and_remove_movie():
    watchlist6 = WatchList()
    watchlist6.add_movie(Movie("Moana", 2016))
    watchlist6.remove_movie(Movie("Moana", 2016))
    assert watchlist6.watch_list == []
    assert watchlist6.size() == 0
Example #5
0
def test_watch_list_remove_movie():
    watchlist5 = WatchList()
    watchlist5.add_movie(Movie("Moana", 2016))
    watchlist5.remove_movie(Movie("Transformers", 2007))
    assert watchlist5.size() == 1
    assert repr(watchlist5.first_movie_in_watchlist()) == "<Movie Moana, 2016>"