コード例 #1
0
    def test_get_title(self):
        file_names = TEST_DATA['compile_truth']
        for t1 in ['Brian', '']:
            for t2 in ['Roger', '', 'Brian']:
                for t3 in ['John', '', 'Brian', 'Roger']:
                    for eo in [SINGLE, DOUBLE, TRIPLE]:
                        for a in [True, False]:
                            for se in [[2, 1], [20, 10], [2, 100]]:
                                if se[1] == 100 and not a:
                                    continue
                                s = ''.join([t1[0] if t1 else '_', t2[0] if t2 else '_',
                                             t3[0] if t3 else '_', 'A' if a else '_', eo[0],
                                             str(len(str(se[0])) + 3), str(len(str(se[1])))])
                                # print(s)

                                file_name = file_names[s]
                                location = os.path.join(ANIME_DIR if a else SERIES_DIR, 'Freddie', 'Season 01', file_name)
                                e = Episode(location=location)
                                title_truth = ''
                                title_split = file_name.split(' - ')
                                if len(title_split) > 1:
                                    title_split = title_split[1].split('.')
                                    if len(title_split) > 1:
                                        title_truth = title_split[0]
                                self.assertEqual(e.get_title(), title_truth)