Esempio n. 1
0
def test_runtime_string():
    movie = Movie("Sharknado", 2020)

    assert movie.get_runtime_string() == ''

    movie.runtime_minutes = 61
    assert movie.get_runtime_string() == '1h 1m'

    movie.runtime_minutes = 59
    assert movie.get_runtime_string() == '59m'
Esempio n. 2
0
def movie_to_dict(movie: Movie):
    movie_dict = {
        'title': movie.title,
        'release_year': movie.release_year,
        'description': movie.description,
        'director': movie.director.director_full_name,
        'runtime_minutes': movie.runtime_minutes,
        'actors': [actor.actor_full_name for actor in movie.actors],
        'genres': [genre.genre_name for genre in movie.genres],
        'reviews': reviews_to_dict(movie.reviews),
        'rating': movie.rating,
        'votes': movie.votes,
        'revenue_in_millions': movie.revenue_in_millions,
        'metascore': movie.metascore,
        'image_link': movie.image_link,
        'runtime_string': movie.get_runtime_string()
    }
    return movie_dict