def test_movie_methods():
    movie1 = Movie("A Star is Born", 2018)
    movie2 = Movie("A Star is Born", 1976)
    movie3 = Movie("Ghostbusters", 1984)

    assert movie1 > movie2
    assert movie2 < movie3
    assert movie1 < movie3
def test_multiple_director():
    movie = Movie("Moana", 2016)
    director1 = Director("Ron Clements")
    director2 = Director("Martin Scorsese")

    movie.director = director1, director2

    print(movie.director)

    movie.director = director1

    print(movie.director)
def test_removal_methods():
    movie = Movie("Avengers: Endgame", 2019)

    actors = [
        Actor("Robert Downey Jr"),
        Actor("Chris Hemsworth"),
        Actor("Tom Holland")
    ]
    genres = [Genre("Action"), Genre("Drama"), Genre("Superhero")]

    for actor in actors:
        movie.add_actor(actor)

    for genre in genres:
        movie.add_genre(genre)

    movie.remove_actor("Tom Holland")
    print(movie.actors)

    movie.remove_genre("Drama")
    print(movie.genres)
Example #4
0
    def dataset_of_movies(self) -> set:
        with open(self.__file_name, mode='r', encoding='utf-8-sig') as csvfile:
            movie_file_reader = csv.DictReader(csvfile)

            movie_set = set()

            for row in movie_file_reader:
                title = row['Title']
                release_year = int(row['Year'])
                movie = Movie(title, release_year)
                movie_set.add(movie)
                genres = row['Genre'].split(",")
                for genre in genres:
                    movie.add_genre(Genre(genre))
                movie.description = row['Description']
                actors = row['Actors'].split(", ")
                for actor in actors:
                    movie.add_actor(Actor(actor))
                movie.runtime_minutes = int(row['Runtime (Minutes)'])

        return movie_set
Example #5
0
def test_watch_and_review():
    user = User("fred", "p@sS")
    watchlist = WatchList()
    watchSim = MovieWatchingSimulation(user, watchlist)
    watchSim.watchlist.add_movie(Movie("Moana", 2016))
    watchSim.watchMovie(0)
    watchSim.add_review(
        Review(Movie("Moana", 2016), "Very fun movie to watch with kids!", 8))

    assert watchSim.watchedMovies == [Movie("Moana", 2016)]
    assert watchSim.get_review_by_movie(Movie("Moana", 2016)) == [
        Review(Movie("Moana", 2016), "Very fun movie to watch with kids!", 8)
    ]
    assert watchSim.watchlist.size() == 0
    assert watchSim.get_review_by_rating(8) == [
        Review(Movie("Moana", 2016), "Very fun movie to watch with kids!", 8)
    ]
def test_movie():
    movie = Movie("Moana", 2016)
    print(movie)

    director = Director("Ron Clements")
    movie.director = director
    print(movie.director)

    actors = [
        Actor("Auli'i Cravalho"),
        Actor("Dwayne Johnson"),
        Actor("Rachel House"),
        Actor("Temuera Morrison")
    ]
    for actor in actors:
        movie.add_actor(actor)
    print(movie.actors)

    movie.runtime_minutes = 107
    print("Movie runtime: {} minutes".format(movie.runtime_minutes))
def movie():
    return Movie()
def test_eq():
    movie1 = Movie("Moana", 2016)
    movie2 = Movie("Moana", 2016)

    assert movie1 == movie2