def testMovieGross(self): """ Tests how much a movie grossed at Box Office """ graph = Graph() graph.parseFile(TESTFILE) tmp_movie = Movies("BlahBlah", "1980", "$121,890,708", "Robert Redford") tmp_actor = Actors("Freeman Blah", 80, "BlahBlah") graph.add_movie(tmp_movie) graph.add_actor(tmp_actor) graph.add_edge(Edges(tmp_actor.name, tmp_movie.name, 222759050.0)) graph.get_movie_gross("The Thomas Crown Affair")
def test_query_2(self): graph = Graph() edges = [] edge = graph.add_edge("Ann Hathaway", "Princess Diaries", 100) edges.append(edge) graph.add_node("Movie", "Princess Diaries", edges, 2019) self.assertEqual(len(graph.edges), 1) self.assertEqual(graph.edges[0].weight, 100) self.assertEqual(graph.get_movie_gross("Princess Diaries"), 100)
""" Tests finding oldest X actors """ graph = Graph() graph.parseFile(TESTFILE) tmp_movie = Movies("BlahBlah", "1980", "$121,890,708", "Robert Redford") tmp_actor = Actors("Freeman Blah", 78, "BlahBlah") graph.add_movie(tmp_movie) graph.add_actor(tmp_actor) graph.add_edge(Edges(tmp_actor.name, tmp_movie.name, 222759050.0)) graph.find_oldest_actors(2) if __name__ == "__main__": #unittest.main() graph = Graph() graph.parseFile(TESTFILE) tmp_movie = Movies("BlahBlah", "1980", "$121,890,708", "Robert Redford") tmp_actor = Actors("Freeman Blah", 78, "BlahBlah") graph.add_movie(tmp_movie) graph.add_actor(tmp_actor) graph.add_edge(Edges(tmp_actor.name, tmp_movie.name, 222759050.0)) graph.get_movies_for_actor("Faye Dunaway") graph.get_movies_for_year("1980") graph.get_movie_actors_for_year("1980") graph.get_actors_for_movie("The Thomas Crown Affair") graph.get_movie_gross("The Thomas Crown Affair") graph.find_highest_grossing_actors(5) graph.find_oldest_actors(2)