本文整理汇总了Python中filmweb.Filmweb类的典型用法代码示例。如果您正苦于以下问题:Python Filmweb类的具体用法?Python Filmweb怎么用?Python Filmweb使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Filmweb类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_movie
def get_movie():
fw = Filmweb()
movies_amount = fw.get_all_movies_number_for_genre(2)
random_movie = randint(1,movies_amount)
movies = fw.search_filtered_movie(title=None, results=(random_movie+10)/10, genre_id=2, search_type='film')
movie = movies[random_movie%10-1]
return movie
示例2: CheckMovieInfos
class CheckMovieInfos(unittest.TestCase):
def setUp(self):
self.fa = Filmweb('http')
self.movie = self.fa.get_movie(107552)
def test_in(self):
found_movies = self.fa.search_movie(u'Dziewczyna z sąsiedztwa')
self.assertTrue( self.movie in found_movies )
def test_levenstein(self):
org_title = u'The Girl Next Door'.replace("The","")
self.assertEqual('The Girl Next Door',self.movie['title_original'])
self.assertEqual( Levenshtein.distance(org_title,self.movie['title_original'].replace("The","")) , 0 )
示例3: SztukaKochaniaTest
class SztukaKochaniaTest(unittest.TestCase):
def setUp(self):
self.fa = Filmweb('http')
self.movie = self.fa.get_movie(763312)
def test_cast(self):
self.assertEquals(len(self.movie['cast']), 30)
self.assertNotEqual(self.movie['cast'][-1]['roleType'], 'aktor')
self.assertEquals(len(self.movie['photos']), 28)
示例4: XmenImagesGalleryTest
class XmenImagesGalleryTest(unittest.TestCase):
def setUp(self):
self.fa = Filmweb('http')
self.movie = self.fa.get_movie(489280)
def test_images(self):
self.assertEqual(len(self.movie['photos']), 46)
for photo in self.movie['photos']:
self.assertIsNotNone(is_valid_url(photo['image']), msg=photo['image'])
示例5: EpisodesTest
class EpisodesTest(unittest.TestCase):
def setUp(self):
self.fa = Filmweb('http')
self.movie = self.fa.get_movie(130177) #Dr House
def test_episode(self):
episode = self.movie['episodes'][47]
self.assertEqual(episode['name'],u'Cane & Able')
self.assertEqual(episode['season'],3)
self.assertEqual(episode['number'],2)
self.assertEqual(episode['date'],datetime.strptime("2006-09-12","%Y-%m-%d" ))
示例6: Osobaparser
class Osobaparser(unittest.TestCase):
def setUp(self):
self.fa = Filmweb('http')
self.osoba = self.fa.get_person(450)
def test_infos(self):
self.assertEqual('Kazimierz Kaczor', self.osoba.title, )
self.assertEqual(self.osoba['birthdate'].month, 2)
self.assertEqual(self.osoba['birthdate'].day, 9)
self.assertEqual(self.osoba['birthdate'].year, 1941)
self.assertIsNotNone(self.osoba.get('poster'))
def test_in(self):
found_osoby = self.fa.search_person("Kazimierz Kaczor")
self.assertTrue(self.osoba in found_osoby)
def test_filmography(self):
filmography = self.osoba['filmography']
self.assertGreater(len(self.osoba['filmography']), 0)
film = filmography[0]
self.assertEqual(film.objID, 742974)
示例7: Movieparser
class Movieparser(unittest.TestCase):
def setUp(self):
self.fa = Filmweb('http')
self.movie = self.fa.get_movie(671)
def test_in(self):
found_movies = self.fa.search_movie('Leon zawodowiec')
self.assertTrue(self.movie in found_movies)
def test_cast(self):
self.assertIsNotNone(self.movie['cast'])
self.assertEqual(len(self.movie['cast']), 101)
p = self.movie['cast'][0]
self.assertEqual(p['title'], u'Jean Reno')
self.assertEqual(p['roleName'], u'Léon')
self.assertEqual(p['roleType'], u'aktor')
self.assertEqual(p.objID, 88)
for type in ['aktor', u'reżyser', 'scenarzysta', u'zdjęcia', 'muzyka', u'montaż', 'scenografia', 'kostiumy',
'producent', u'dźwięk']:
self.assertTrue(
any([cast for cast in self.movie['cast'] if cast['roleType'] == type]), msg='missing %s' % type
)
def test_infos(self):
self.assertEqual(len(self.movie['additionalinfo']), 5)
self.assertEqual(len(self.movie['basicinfo']), 5)
self.assertEqual(len(self.movie['photos']), 45)
self.assertEqual('Leon zawodowiec', self.movie.title, )
# self.assertEqual('Léon',self.movie['title_original'],)
def test_year(self):
self.assertEqual(self.movie['year'], '1994')