Пример #1
0
def test_8():
    actor1 = Actor("Apple")
    actor2 = Actor("Banana")
    actor3 = Actor("Pear")
    list = [actor3, actor1, actor2]
    list.sort()
    assert list == [actor1, actor2, actor3]
Пример #2
0
def test_movie_actor(file_reader):
    assert file_reader.dataset_of_movies[0].actors == [
        Actor("Chris Pratt"),
        Actor("Vin Diesel"),
        Actor("Bradley Cooper"),
        Actor("Zoe Saldana")
    ]
Пример #3
0
def test_given(movie):
    movie = Movie("Moana", 2016)
    assert movie == Movie("Moana", 2016)

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

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

    movie.runtime_minutes = 107
    assert movie.runtime_minutes == 107
Пример #4
0
 def read_csv_file(self):
     with open(self.__file_name, mode='r', encoding='utf-8-sig') as csvfile:
         movie_file_reader = csv.DictReader(csvfile)
         index = 0
         for row in movie_file_reader:
             movie = Movie(row["Title"], int(row["Year"]))
             movie.description = row["Description"]
             movie.runtime_minutes = int(row["Runtime (Minutes)"])
             self.__total_runtime_minutes += int(row["Runtime (Minutes)"])
             self.__runtime_minutes_number_of_movies += 1
             if row["Rating"] != "N/A":
                 movie.rating = float(row['Rating'])
                 self.__total_rating += float(row['Rating'])
                 self.__rating_number_of_movies += 1
             if row["Votes"] != "N/A":
                 movie.votes = int(row["Votes"])
                 self.__total_votes += int(row["Votes"])
                 self.__votes_number_of_movies += 1
             if row["Revenue (Millions)"] != "N/A":
                 movie.revenue_millions = float(row["Revenue (Millions)"])
                 self.__total_revenue_millions += float(
                     row["Revenue (Millions)"])
                 self.__revenue_millions_number_of_movies += 1
             if row["Metascore"] != "N/A":
                 movie.metascore = int(row["Metascore"])
                 self.__total_metascore += int(row["Metascore"])
                 self.__metascore_number_of_movies += 1
             movie.director = Director(row["Director"])
             self.__dataset_of_directors.add(Director(row["Director"]))
             for actor in row["Actors"].split(","):
                 movie.add_actor(Actor(actor.strip()))
                 self.__dataset_of_actors.add(Actor(actor.strip()))
             for genre in row["Genre"].split(","):
                 movie.add_genre(Genre(genre.strip()))
                 self.__dataset_of_genres.add(Genre(genre.strip()))
             index += 1
             self.__dataset_of_movies.append(movie)
Пример #5
0
def test_2():
    actor = Actor("123")
    assert actor.actor_full_name == "123"
    assert actor.__repr__() == "<Actor 123>"
Пример #6
0
def test_8():
    actor1 = Actor("Apple")
    actor2 = Actor("Banana")
    actor1.add_actor_colleague(actor2)
    assert actor1.check_if_this_actor_worked_with(actor2)
    assert not actor2.check_if_this_actor_worked_with(actor1)
Пример #7
0
def test_1():
    actor = Actor(123)
    assert actor.actor_full_name is None
Пример #8
0
def test_7():
    actor1 = Actor(123)
    actor2 = Actor(321)
    assert actor1 == actor2
Пример #9
0
def test_6():
    actor1 = Actor("Banana")
    actor2 = Actor("banana")
    assert actor1 != actor2
Пример #10
0
def test_5():
    actor1 = Actor("Banana")
    actor2 = Actor("Banana")
    assert actor1 == actor2
Пример #11
0
def test_4():
    actor = Actor("Banana")
    assert actor.actor_full_name == "Banana"
    assert actor.__repr__() == "<Actor Banana>"
Пример #12
0
def test_movie_actor():
    filename = 'movie_web_app/adapters/Data1000Movies.csv'
    file_reader = MovieFileCSVReader(filename)
    assert file_reader.dataset_of_movies[0].actors == [Actor("Chris Pratt"), Actor("Vin Diesel"), Actor("Bradley Cooper"), Actor("Zoe Saldana")]