def dict_to_movie(dict): movie = Movie(dict.title, dict.release) movie.description = dict.description movie.director = dict.director movie.actors = dict.actors movie.genres = dict.genres movie.runtime_minutes = dict.runtime movie.revenue = dict.revenue
def test_movie_genres(): # correct input movie1 = Movie("Moana", 2016) movie1.genres = [Genre("Animation"), Genre("Comedy")] assert movie1.genres == [Genre("Animation"), Genre("Comedy")] # incorrect input movie2 = Movie("Frozen", 2014)
def test_genre(): movie = Movie("Moana", 2016) genres = [ Genre("Animation"), Genre("Action"), Genre("Fantasy"), Genre("Children's film"), Genre("Adventure") ] for genre in genres: movie.add_genre(genre) movie.add_genre("fake genre") assert repr( movie.genres ) == "[<Genre Animation>, <Genre Action>, <Genre Fantasy>, <Genre Children's film>, <Genre Adventure>]" movie.genres = [] assert repr(movie.genres) == "[]" movie.genres = [1, 2, 3] assert repr(movie.genres) == "[]"