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
def test_watch_list_select_movie_out_of_range(): watchlist8 = WatchList() watchlist8.add_movie(Movie("Moana", 2016)) watchlist8.add_movie(Movie("Transformers", 2007)) watchlist8.add_movie(Movie("Ice Age", 2002)) assert repr(watchlist8.select_movie_to_watch(3)) == "None"
def test_watch_list_select_movie(): watchlist7 = WatchList() watchlist7.add_movie(Movie("Moana", 2016)) watchlist7.add_movie(Movie("Transformers", 2007)) watchlist7.add_movie(Movie("Ice Age", 2002)) assert repr(watchlist7.select_movie_to_watch(2)) == "<Movie Ice Age, 2002>"