def test_sceneExceptionByNameAnime(self): sickbeard.showList = None sickbeard.showList = [Show(1, 79604), Show(1, 295243)] sickbeard.showList[0].anime = 1 sickbeard.showList[1].anime = 1 scene_exceptions.retrieve_exceptions() name_cache.buildNameCache() self.assertEqual(scene_exceptions.get_scene_exception_by_name(u'ブラック・ラグーン'), [79604, -1]) self.assertEqual(scene_exceptions.get_scene_exception_by_name(u'Burakku Ragūn'), [79604, -1]) self.assertEqual(scene_exceptions.get_scene_exception_by_name('Rokka no Yuusha'), [295243, -1])
def _test_allPossibleShowNames(self, name, indexerid=0, expected=[]): s = Show(1, indexerid) s.name = name result = show_name_helpers.allPossibleShowNames(s) self.assertTrue( len(set(expected).intersection(set(result))) == len(expected))
def _test_allPossibleShowNames(self, name, tvdbid=0, tvrname=None, expected=[]): s = Show(tvdbid) s.name = name s.tvrname = tvrname result = show_name_helpers.allPossibleShowNames(s) self.assertTrue(len(set(expected).intersection(set(result))) == len(expected))
def setUp(self): sickbeard.QUALITY_DEFAULT = 2 self.show = Show(1, 1) sickbeard.REQUIRE_WORDS = 'REQUIRED' sickbeard.IGNORE_WORDS = 'IGNORED' # These are opposite of global, to prove they override self.show.rls_ignore_words = 'REQUIRED' self.show.rls_require_words = 'IGNORED'
def search_indexers_for_series_id(self, name=None, indexerid=None, language=None, indexer=None): if not indexer: indexer = self.indexers.keys() if isinstance(indexer, (int, six.string_types)): indexer = [indexer] if isinstance(name, six.string_types): name = [name] if indexerid: indexerid = int(indexerid) if not language: language = sickbeard.INDEXER_DEFAULT_LANGUAGE assert bool(indexerid) or bool( name ), "Must provide either a name or an indexer id to search indexers with" for n in name or "X": n = [re.sub('[. -]', ' ', n)] for i in indexer: search = (name, indexerid)[bool(indexerid)] # noinspection PyUnresolvedReferences logger.log( "Trying to find {} on {}".format(search, self.name(i)), logger.DEBUG) if indexerid: result = self.indexers[i].get_series_by_id( indexerid, language) else: result = self.indexers[i].get_series_by_name( n, indexerid, language) try: # noinspection PyUnusedLocal garbage = result.seriesName, result.id except AttributeError: # noinspection PyUnresolvedReferences logger.log( "Failed to find {} on {}".format(search, self.name(i)), logger.DEBUG) continue ShowObj = Show.find(sickbeard.showList, result.id) if indexerid and ShowObj and ShowObj.indexerid == result.id: return i, result elif indexerid and indexerid == result.id: return i, result return None, None
def test_isGoodName(self): listOfcases = [('Show.Name.S01E02.Test-Test', 'Show/Name'), ('Show.Name.S01E02.Test-Test', 'Show. Name'), ('Show.Name.S01E02.Test-Test', 'Show- Name'), ('Show.Name.Part.IV.Test-Test', 'Show Name'), ('Show.Name.S01.Test-Test', 'Show Name'), ('Show.Name.E02.Test-Test', 'Show: Name'), ('Show Name Season 2 Test', 'Show: Name'), ] for testCase in listOfcases: scene_name, show_name = testCase s = Show(0) s.name = show_name self._test_isGoodName(scene_name, s)
def _test_all_possible_show_names(self, name, indexerid=0, expected=None): """ Test all possible show names :param name: :param indexerid: :param expected: :return: """ expected = [] if expected is None else expected show = Show(1, indexerid) show.name = name result = show_name_helpers.allPossibleShowNames(show) self.assertTrue(len(set(expected).intersection(set(result))) == len(expected))
def _test_allPossibleShowNames(self, name, tvdbid=0, tvrname=None, expected=[]): s = Show(tvdbid) s.name = name s.tvrname = tvrname result = show_name_helpers.allPossibleShowNames(s) result = [unicode(x) for x in sorted(result)] expected = [unicode(x) for x in sorted(expected)] #self.assertEqual(len(set(expected).intersection(set(result))), len(expected)) self.assertEqual(result, expected)
def test_is_good_name(self): """ Perform good name tests """ list_of_cases = [ ('Show.Name.S01E02.Test-Test', 'Show/Name'), ('Show.Name.S01E02.Test-Test', 'Show. Name'), ('Show.Name.S01E02.Test-Test', 'Show- Name'), ('Show.Name.Part.IV.Test-Test', 'Show Name'), ('Show.Name.S01.Test-Test', 'Show Name'), ('Show.Name.E02.Test-Test', 'Show: Name'), ('Show Name Season 2 Test', 'Show: Name'), ] for test_case in list_of_cases: scene_name, show_name = test_case show = Show(1, 0) show.name = show_name self._test_is_good_name(scene_name, show)
def setUp(self): super(SceneExceptionTestCase, self).setUp() sickbeard.showList = [Show(1, 79604), Show(1, 251085)] scene_exceptions.retrieve_exceptions() name_cache.buildNameCache()