Ejemplo n.º 1
0
def test_given(watchlist):
    watchlist = WatchList()
    assert watchlist.size() == 0
    watchlist.add_movie(Movie("Moana", 2016))
    watchlist.add_movie(Movie("Ice Age", 2002))
    watchlist.add_movie(Movie("Guardians of the Galaxy", 2012))
    assert watchlist.first_movie_in_watchlist() == Movie("Moana", 2016)
Ejemplo n.º 2
0
def test_select_movie_to_watch(watchlist):
    watchlist = WatchList()
    watchlist.add_movie(Movie("Moana", 2016))
    watchlist.add_movie(Movie("Ice Age", 2002))
    watchlist.add_movie(Movie("Guardians of the Galaxy", 2012))
    assert watchlist.select_movie_to_watch(2) == Movie(
        "Guardians of the Galaxy", 2012)
Ejemplo n.º 3
0
def test_iterator(watchlist):
    watchlist = WatchList()
    watchlist.add_movie(Movie("Moana", 2016))
    watchlist.add_movie(Movie("Ice Age", 2002))
    watchlist.add_movie(Movie("Guardians of the Galaxy", 2012))
    temp = iter(watchlist)
    assert next(temp) == Movie("Moana", 2016)
Ejemplo n.º 4
0
 def __init__(self, username: str, password: str):
     self.__username = username.strip().lower()
     self.__password = password
     self.__watched_movies = []
     self.__reviews = []
     self.__time_spent_watching_movies_minutes = 0
     self.__watch_list = WatchList()
Ejemplo n.º 5
0
def test_iterator_out_of_bound(watchlist):
    watchlist = WatchList()
    watchlist.add_movie(Movie("Moana", 2016))
    watchlist.add_movie(Movie("Ice Age", 2002))
    watchlist.add_movie(Movie("Guardians of the Galaxy", 2012))
    temp = iter(watchlist)
    next(temp)
    next(temp)
    next(temp)
    with pytest.raises(StopIteration):
        next(temp)
Ejemplo n.º 6
0
def watchlist():
    return WatchList()
Ejemplo n.º 7
0
def test_remove_movie(watchlist):
    watchlist = WatchList()
    watchlist.add_movie(Movie("Moana", 2016))
    watchlist.remove_movie(Movie("Moana", 2016))
    assert watchlist.size() == 0
Ejemplo n.º 8
0
def test_remove_moive_not_in_list(watchlist):
    watchlist = WatchList()
    watchlist.add_movie(Movie("Moana", 2016))
    watchlist.remove_movie(Movie("Ice Age", 2002))
    assert watchlist.size() == 1
Ejemplo n.º 9
0
def test_size(watchlist):
    watchlist = WatchList()
    watchlist.add_movie(Movie("Moana", 2016))
    watchlist.add_movie(Movie("Ice Age", 2002))
    watchlist.add_movie(Movie("Guardians of the Galaxy", 2012))
    assert watchlist.size() == 3