コード例 #1
0
ファイル: test_t411.py プロジェクト: shangshanshi/Flexget
 def test_map_term_type_tree(self):
     tree = {
         "234": {
             "11": {
                 "type": "Application - Genre",
                 "mode": "single",
                 "terms": {
                     "158": "Edition multim\u00e9dia",
                     "126": "Administration",
                     "190": "Utilitaire",
                     "169": "Lecteur multim\u00e9dia",
                     "137": "Aspiration de site",
                     "180": "Registre",
                     "148": "Communaut\u00e9"
                 }
             },
             "43": {
                 "type": "Langue",
                 "mode": "single",
                 "terms": {
                     "729": "Fran\u00e7ais",
                     "730": "Anglais",
                     "731": "Multi (Fran\u00e7ais inclus)",
                     "830": "Japonais"
                 }
             }
         }
     }
     category_to_term_type, term_types = T411ObjectMapper(
     ).map_term_type_tree(tree)
     assert (234, 11) in category_to_term_type
     assert (234, 43) in category_to_term_type
     assert 11 in term_types
     assert 43 in term_types
     assert term_types.get(11).mode == 'single'
     assert term_types.get(11).name == 'Application - Genre', \
         'Expected "Application - Genre", found "%s"' % term_types.get(11).name
     assert len(term_types.get(11).terms) == 7
     term_names = [term.name for term in term_types.get(11).terms]
     assert "Edition multimédia" in term_names
コード例 #2
0
ファイル: test_t411.py プロジェクト: edetaillac/Flexget
 def test_map_category(self):
     category = T411ObjectMapper().map_category({
         u'pid': u'0',
         u'id': u'210',
         u'name': u'Film/Vidéo',
         u'cats': {
             u'631': {u'pid': u'210', u'id': u'631', u'name': u'Film'},
             u'633': {u'pid': u'210', u'id': u'633', u'name': u'Concert'},
             u'634': {u'pid': u'210', u'id': u'634', u'name': u'Documentaire'},
             u'635': {u'pid': u'210', u'id': u'635', u'name': u'Spectacle'},
             u'636': {u'pid': u'210', u'id': u'636', u'name': u'Sport'},
             u'637': {u'pid': u'210', u'id': u'637', u'name': u'Animation Série'},
             u'639': {u'pid': u'210', u'id': u'639', u'name': u'Emission TV'},
             u'455': {u'pid': u'210', u'id': u'455', u'name': u'Animation'},
             u'402': {u'pid': u'210', u'id': u'402', u'name': u'Vidéo-clips'},
             u'433': {u'pid': u'210', u'id': u'433', u'name': u'Série TV'}
         }
     })
     assert category.id == 210
     assert category.parent_id is None
     assert category.name == u'Film/Vidéo'
     assert len(category.sub_categories) == 10
コード例 #3
0
ファイル: test_t411.py プロジェクト: cyberguard/Flexget
 def __init__(self):
     self.mapper = T411ObjectMapper()