Example #1
0
 def test_parse_actors(self):
     actors = Film.parse_actors(self.soup)
     expected = {'Julian Arahanga': 'Apoc', 'Carrie-Anne Moss': 'Trinity',
                 'Gloria Foster': 'Wyrocznia', 'Marcus Chong': 'Tank',
                 'Hugo Weaving': 'Agent Smith', 'Keanu Reeves': 'Neo',
                 'Laurence Fishburne': 'Morfeusz', 'Joe Pantoliano': 'Cypher'}
     self.assertDictEqual(actors, expected)
Example #2
0
 def test_get_by_id(self):
     film = Film.get_by_id(868)
     self.assertIsInstance(film, Film)
     self.assertEqual(film.title, "Być jak John Malkovich")
     self.assertEqual(film.url, "http://www.filmweb.pl/film/By%C4%87+jak+John+Malkovich-1999-868")
     self.assertEqual(film.year, 1999)
     self.assertEqual(film.id_, 868)
Example #3
0
 def setUp(self):
     self.films = list(Film.search("john malkovich"))
     self.example = self.films[0]
     
     #several directors, screenwriters, genres, countries
     self.soup = make_request("http://www.filmweb.pl/Matrix")
     
     #no descrition; duration less than hour
     self.soup2 = make_request("http://www.filmweb.pl/film/Sipur+Ahava-1990-352246")
Example #4
0
 def test_search_multiple_pages(self):
     """
     Walking through a series of pages
     """
     results = list(Film.search("terminator", max_page=3))
     single_film = results[0]
     self.assertEqual(len(results), 30)
     self.assertIsInstance(single_film, Film)
     self.assertEqual(single_film.title, "Terminator")
     self.assertEqual(single_film.url, "http://www.filmweb.pl/Terminator")
Example #5
0
 def test_search_multiple_pages(self):
     """
     Walking through a series of pages
     """
     results = list(Film.search("terminator", max_page=3))
     single_film = results[0]
     self.assertEqual(len(results), 28)
     self.assertIsInstance(single_film, Film)
     self.assertEqual(single_film.title, "Terminator: Mroczne przeznaczenie")
     self.assertEqual(single_film.url, "http://www.filmweb.pl/film/Terminator%3A+Mroczne+przeznaczenie-2019-723372")
Example #6
0
 def test_parse_genre(self):
     genres = Film.parse_genre(self.soup)
     self.assertListEqual(genres, ["Akcja", "Sci-Fi"])
Example #7
0
 def test_parse_duration_lt_hour(self):
     """
     Film is shorter than 1 hour
     """
     dur = Film.parse_duration(self.soup2)
     self.assertEqual(dur, datetime.time(0, 30))
Example #8
0
 def test_parse_duration(self):
     dur = Film.parse_duration(self.soup)
     self.assertEqual(dur, datetime.time(2, 16))
Example #9
0
 def test_parse_director(self):
     directors = Film.parse_director(self.soup)
     self.assertListEqual(directors, ["Lilly Wachowski", "Lana Wachowski"])
Example #10
0
 def test_parse_no_description(self):
     """
     Film has no description
     """
     descr = Film.parse_description(self.soup2)
     self.assertEqual(descr, "")
Example #11
0
 def test_parse_description(self):
     descr = Film.parse_description(self.soup)
     expected = "Haker komputerowy Neo dowiaduje się od tajemniczych " \
                "rebeliantów, że świat, w którym żyje, jest tylko " \
                "obrazem przesyłanym do jego mózgu przez roboty."
     self.assertEqual(descr, expected)
Example #12
0
 def test_parse_country(self):
     countries = Film.parse_country(self.soup)
     self.assertListEqual(countries, ["Australia", "USA"])
Example #13
0
 def test_parse_original_title(self):
     o_title = Film.parse_original_title(self.soup)
     self.assertEqual(o_title, "The Matrix")
Example #14
0
 def test_get_by_id_not_found(self):
     film = Film.get_by_id(67825)
     self.assertIsNone(film)
Example #15
0
 def test_parse_screenwriter(self):
     screenwriters = Film.parse_screenwriter(self.soup)
     self.assertListEqual(screenwriters, ["Lilly Wachowski", "Lana Wachowski"])
Example #16
0
 def test_search_no_results(self):
     results = list(Film.search("sdfghjfghj"))
     self.assertListEqual(results, [])
Example #17
0
 def test_parse_topics(self):
     count = Film.parse_topics(self.soup)
     self.assertGreaterEqual(count, 0)
Example #18
0
 def test_parse_budget(self):
     budget = Film.parse_budget(self.soup)
     self.assertEqual(63000000, budget)
Example #19
0
 def test_parse_boxoffice(self):
     boxoffice = Film.parse_boxoffice(self.soup)
     self.assertEqual(463517383, boxoffice)