test_name_parser.py 20.6 KB
Newer Older
echel0n's avatar
echel0n committed
1
#!/usr/bin/env python2.7
2
# Author: echel0n <[email protected]>
echel0n's avatar
echel0n committed
3
# URL: https://sickrage.ca
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# SickRage is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with SickRage.  If not, see <http://www.gnu.org/licenses/>.

20
from __future__ import print_function
21 22
from __future__ import unicode_literals

23
import os.path
24
import unittest
echel0n's avatar
echel0n committed
25 26
from datetime import date

27
import sickrage
echel0n's avatar
echel0n committed
28
import tests
29 30
from sickrage.core.nameparser import ParseResult, NameParser, InvalidNameException, InvalidShowException
from sickrage.core.tv.show import TVShow
31

32
sickrage.app.sys_encoding = 'UTF-8'
33 34 35 36

DEBUG = VERBOSE = False

simple_test_cases = {
37
    'standard': {
38 39 40 41
        'Mr Show Name.S00E01E02E03E04E05E06E07E08.Source.Quality.Etc-Group': ParseResult(None, 'Mr Show Name', 0,
                                                                                         [1, 2, 3, 4, 5, 6, 7, 8],
                                                                                         'Source.Quality.Etc',
                                                                                         'Group'),
echel0n's avatar
echel0n committed
42 43
        'Mr.Show.Name.S01E02.Source.Quality.Etc-Group': ParseResult(None, 'Mr Show Name', 1, [2], 'Source.Quality.Etc',
                                                                    'Group'),
44 45
        'Show.Name.S01E02': ParseResult(None, 'Show Name', 1, [2]),
        'Show Name - S01E02 - My Ep Name': ParseResult(None, 'Show Name', 1, [2], 'My Ep Name'),
echel0n's avatar
echel0n committed
46 47 48 49
        'Show.1.0.Name.S01.E03.My.Ep.Name-Group': ParseResult(None, 'Show 1.0 Name', 1, [3], 'My.Ep.Name', 'Group'),
        'Show.Name.S01E02E03.Source.Quality.Etc-Group': ParseResult(None, 'Show Name', 1, [2, 3], 'Source.Quality.Etc',
                                                                    'Group'),
        'Mr. Show Name - S01E02-03 - My Ep Name': ParseResult(None, 'Mr. Show Name', 1, [2, 3], 'My Ep Name'),
50
        'Show.Name.S01.E02.E03': ParseResult(None, 'Show Name', 1, [2, 3]),
echel0n's avatar
echel0n committed
51
        'Show.Name-0.2010.S01E02.Source.Quality.Etc-Group': ParseResult(None, 'Show Name-0 2010', 1, [2],
52
                                                                        'Source.Quality.Etc', 'Group'),
53
        'S01E02 Ep Name': ParseResult(None, None, 1, [2], 'Ep Name'),
echel0n's avatar
echel0n committed
54
        'Show Name - S06E01 - 2009-12-20 - Ep Name': ParseResult(None, 'Show Name', 6, [1], '2009-12-20 - Ep Name'),
55 56 57 58
        'Show Name - S06E01 - -30-': ParseResult(None, 'Show Name', 6, [1], '30-'),
        'Show-Name-S06E01-720p': ParseResult(None, 'Show-Name', 6, [1], '720p'),
        'Show-Name-S06E01-1080i': ParseResult(None, 'Show-Name', 6, [1], '1080i'),
        'Show.Name.S06E01.Other.WEB-DL': ParseResult(None, 'Show Name', 6, [1], 'Other.WEB-DL'),
echel0n's avatar
echel0n committed
59 60
        'Show.Name.S06E01 Some-Stuff Here': ParseResult(None, 'Show Name', 6, [1], 'Some-Stuff Here'),
        'Show Name - S03E14-36! 24! 36! Hut! (1)': ParseResult(None, 'Show Name', 3, [14], '36! 24! 36! Hut! (1)'),
61 62 63
    },

    'fov': {
echel0n's avatar
echel0n committed
64
        'Show_Name.1x02.Source_Quality_Etc-Group': ParseResult(None, 'Show Name', 1, [2], 'Source_Quality_Etc',
65
                                                               'Group'),
66 67 68 69
        'Show Name 1x02': ParseResult(None, 'Show Name', 1, [2]),
        'Show Name 1x02 x264 Test': ParseResult(None, 'Show Name', 1, [2], 'x264 Test'),
        'Show Name - 1x02 - My Ep Name': ParseResult(None, 'Show Name', 1, [2], 'My Ep Name'),
        'Show_Name.1x02x03x04.Source_Quality_Etc-Group': ParseResult(None, 'Show Name', 1, [2, 3, 4],
70
                                                                     'Source_Quality_Etc', 'Group'),
echel0n's avatar
echel0n committed
71
        'Show Name - 1x02-03-04 - My Ep Name': ParseResult(None, 'Show Name', 1, [2, 3, 4], 'My Ep Name'),
72 73 74 75 76
        '1x02 Ep Name': ParseResult(None, None, 1, [2], 'Ep Name'),
        'Show-Name-1x02-720p': ParseResult(None, 'Show-Name', 1, [2], '720p'),
        'Show-Name-1x02-1080i': ParseResult(None, 'Show-Name', 1, [2], '1080i'),
        'Show Name [05x12] Ep Name': ParseResult(None, 'Show Name', 5, [12], 'Ep Name'),
        'Show.Name.1x02.WEB-DL': ParseResult(None, 'Show Name', 1, [2], 'WEB-DL')
77 78 79
    },

    'standard_repeat': {
80
        'Show.Name.S01E02.S01E03.Source.Quality.Etc-Group': ParseResult(None, 'Show Name', 1, [2, 3],
81
                                                                        'Source.Quality.Etc', 'Group'),
82
        'Show.Name.S01E02.S01E03': ParseResult(None, 'Show Name', 1, [2, 3]),
echel0n's avatar
echel0n committed
83
        'Show Name - S01E02 - S01E03 - S01E04 - Ep Name': ParseResult(None, 'Show Name', 1, [2, 3, 4], 'Ep Name'),
84
        'Show.Name.S01E02.S01E03.WEB-DL': ParseResult(None, 'Show Name', 1, [2, 3], 'WEB-DL')
85 86 87
    },

    'fov_repeat': {
echel0n's avatar
echel0n committed
88 89
        'Show.Name.1x02.1x03.Source.Quality.Etc-Group': ParseResult(None, 'Show Name', 1, [2, 3], 'Source.Quality.Etc',
                                                                    'Group'),
90
        'Show.Name.1x02.1x03': ParseResult(None, 'Show Name', 1, [2, 3]),
echel0n's avatar
echel0n committed
91
        'Show Name - 1x02 - 1x03 - 1x04 - Ep Name': ParseResult(None, 'Show Name', 1, [2, 3, 4], 'Ep Name'),
92
        'Show.Name.1x02.1x03.WEB-DL': ParseResult(None, 'Show Name', 1, [2, 3], 'WEB-DL')
93 94 95
    },

    'bare': {
echel0n's avatar
echel0n committed
96
        'Show.Name.102.Source.Quality.Etc-Group': ParseResult(None, 'Show Name', 1, [2], 'Source.Quality.Etc', 'Group'),
97
        'show.name.2010.123.source.quality.etc-group': ParseResult(None, 'show name 2010', 1, [23],
98
                                                                   'source.quality.etc', 'group'),
echel0n's avatar
echel0n committed
99
        'show.name.2010.222.123.source.quality.etc-group': ParseResult(None, 'show name 2010.222', 1, [23],
100
                                                                       'source.quality.etc', 'group'),
101
        'Show.Name.102': ParseResult(None, 'Show Name', 1, [2]),
echel0n's avatar
echel0n committed
102
        'Show.Name.01e02': ParseResult(None, 'Show Name', 1, [2]),
103
        'the.event.401.hdtv-group': ParseResult(None, 'the event', 4, [1], 'hdtv', 'group'),
104
        'show.name.2010.special.hdtv-blah': None,
105
        'show.ex-name.102.hdtv-group': ParseResult(None, 'show ex-name', 1, [2], 'hdtv', 'group'),
106 107 108
    },

    'stupid': {
echel0n's avatar
echel0n committed
109 110
        'tpz-abc102': ParseResult(None, 'abc', 1, [2], None, 'tpz'),
        'tpz-abc.102': ParseResult(None, 'abc', 1, [2], None, 'tpz')
111 112 113
    },

    'no_season': {
114 115
        'Show Name - 01 - Ep Name': ParseResult(None, 'Show Name', None, [1], 'Ep Name'),
        '01 - Ep Name': ParseResult(None, None, None, [1], 'Ep Name'),
echel0n's avatar
echel0n committed
116
        'Show Name - 01 - Ep Name - WEB-DL': ParseResult(None, 'Show Name', None, [1], 'Ep Name - WEB-DL')
117 118 119
    },

    'no_season_general': {
echel0n's avatar
echel0n committed
120
        'Show.Name.E23.Source.Quality.Etc-Group': ParseResult(None, 'Show Name', None, [23], 'Source.Quality.Etc',
121
                                                              'Group'),
echel0n's avatar
echel0n committed
122 123 124 125 126 127 128
        'Show Name - Episode 01 - Ep Name': ParseResult(None, 'Show Name', None, [1], 'Ep Name'),
        'Show.Name.Part.3.Source.Quality.Etc-Group': ParseResult(None, 'Show Name', None, [3], 'Source.Quality.Etc',
                                                                 'Group'),
        'Show.Name.Part.1.and.Part.2.Blah-Group': ParseResult(None, 'Show Name', None, [1, 2], 'Blah', 'Group'),
        'Show.Name.Part.IV.Source.Quality.Etc-Group': ParseResult(None, 'Show Name', None, [4], 'Source.Quality.Etc',
                                                                  'Group'),
        'Deconstructed.E07.1080i.HDTV.DD5.1.MPEG2-TrollHD': ParseResult(None, 'Deconstructed', None, [7],
129
                                                                        '1080i.HDTV.DD5.1.MPEG2', 'TrollHD'),
130
        'Show.Name.E23.WEB-DL': ParseResult(None, 'Show Name', None, [23], 'WEB-DL'),
131 132 133
    },

    'no_season_multi_ep': {
134
        'Show.Name.E23-24.Source.Quality.Etc-Group': ParseResult(None, 'Show Name', None, [23, 24],
135
                                                                 'Source.Quality.Etc', 'Group'),
136 137
        'Show Name - Episode 01-02 - Ep Name': ParseResult(None, 'Show Name', None, [1, 2], 'Ep Name'),
        'Show.Name.E23-24.WEB-DL': ParseResult(None, 'Show Name', None, [23, 24], 'WEB-DL')
138 139 140
    },

    'season_only': {
echel0n's avatar
echel0n committed
141
        'Show.Name.S02.Source.Quality.Etc-Group': ParseResult(None, 'Show Name', 2, [], 'Source.Quality.Etc', 'Group'),
142 143
        'Show Name Season 2': ParseResult(None, 'Show Name', 2),
        'Season 02': ParseResult(None, None, 2)
144 145 146
    },

    'scene_date_format': {
echel0n's avatar
echel0n committed
147 148
        'Show.Name.2010.11.23.Source.Quality.Etc-Group': ParseResult(None, 'Show Name', None, [], 'Source.Quality.Etc',
                                                                     'Group', date(2010, 11, 23)),
echel0n's avatar
echel0n committed
149
        'Show Name - 2010.11.23': ParseResult(None, 'Show Name', air_date=date(2010, 11, 23)),
echel0n's avatar
echel0n committed
150 151
        'Show.Name.2010.23.11.Source.Quality.Etc-Group': ParseResult(None, 'Show Name', None, [], 'Source.Quality.Etc',
                                                                     'Group', date(2010, 11, 23)),
152
        'Show Name - 2010-11-23 - Ep Name': ParseResult(None, 'Show Name', extra_info='Ep Name',
echel0n's avatar
echel0n committed
153
                                                        air_date=date(2010, 11, 23)),
echel0n's avatar
echel0n committed
154 155 156 157 158 159 160 161 162 163 164
        '2010-11-23 - Ep Name': ParseResult(None, extra_info='Ep Name', air_date=date(2010, 11, 23)),
        'Show.Name.2010.11.23.WEB-DL': ParseResult(None, 'Show Name', None, [], 'WEB-DL', None, date(2010, 11, 23))
    },
}

anime_test_cases = {
    'anime_SxxExx': {
        'Show Name - S01E02 - Ep Name': ParseResult(None, 'Show Name', 1, [2], 'Ep Name', version=-1),
        'Show Name - S01E02-03 - My Ep Name': ParseResult(None, 'Show Name', 1, [2, 3], 'My Ep Name', version=-1),
        'Show Name - S01E02': ParseResult(None, 'Show Name', 1, [2], version=-1),
        'Show Name - S01E02-03': ParseResult(None, 'Show Name', 1, [2, 3], version=-1),
165 166
    },
}
167 168

combination_test_cases = [
169
    ('/test/path/to/Season 02/03 - Ep Name.avi',
echel0n's avatar
echel0n committed
170 171
     ParseResult(None, None, 2, [3], 'Ep Name', version=-1),
     {'no_season', 'season_only'}),
172

173
    ('Show.Name.S02.Source.Quality.Etc-Group/tpz-sn203.avi',
echel0n's avatar
echel0n committed
174 175
     ParseResult(None, 'Show Name', 2, [3], 'Source.Quality.Etc', 'Group', version=-1),
     {'stupid', 'season_only'}),
176

177
    ('MythBusters.S08E16.720p.HDTV.x264-aAF/aaf-mb.s08e16.720p.mkv',
echel0n's avatar
echel0n committed
178 179
     ParseResult(None, 'MythBusters', 8, [16], '720p.HDTV.x264', 'aAF', version=-1),
     {'standard'}),
180

181
    (
182 183 184
        '/home/drop/storage/TV/Terminator The Sarah Connor Chronicles/Season 2/S02E06 The Tower is Tall, But the Fall is Short.mkv',
        ParseResult(None, None, 2, [6], 'The Tower is Tall, But the Fall is Short', version=-1),
        {'standard', 'season_only'}),
185

186
    (r'/Test/TV/Jimmy Fallon/Season 2/Jimmy Fallon - 2010-12-15 - blah.avi',
echel0n's avatar
echel0n committed
187 188
     ParseResult(None, 'Jimmy Fallon', extra_info='blah', air_date=date(2010, 12, 15), version=-1),
     {'scene_date_format', 'season_only'}),
189

190
    (r'/X/30 Rock/Season 4/30 Rock - 4x22 -.avi',
echel0n's avatar
echel0n committed
191 192
     ParseResult(None, '30 Rock', 4, [22], version=-1),
     {'fov', 'season_only'}),
193

echel0n's avatar
echel0n committed
194 195 196
    ('Season 2\\Show Name - 03-04 - Ep Name.avi',
     ParseResult(None, 'Show Name', 2, [3, 4], extra_info='Ep Name', version=-1),
     {'no_season', 'season_only'}),
197

echel0n's avatar
echel0n committed
198 199 200
    ('Season 02\\03-04-05 - Ep Name.avi',
     ParseResult(None, None, 2, [3, 4, 5], extra_info='Ep Name', version=-1),
     {'no_season', 'season_only'}),
201
]
202 203

unicode_test_cases = [
204
    ('The.Big.Bang.Theory.2x07.The.Panty.Pi\xf1ata.Polarization.720p.HDTV.x264.AC3-SHELDON.mkv',
205
     ParseResult(None, 'The.Big.Bang.Theory', 2, [7],
206 207
                 'The.Panty.Pi\xf1ata.Polarization.720p.HDTV.x264.AC3',
                 'SHELDON')),
208
    ('The.Big.Bang.Theory.2x07.The.Panty.Pi\xc3\xb1ata.Polarization.720p.HDTV.x264.AC3-SHELDON.mkv',
209
     ParseResult(None, 'The.Big.Bang.Theory', 2, [7],
210 211
                 'The.Panty.Pi\xc3\xb1ata.Polarization.720p.HDTV.x264.AC3',
                 'SHELDON'))
212
]
213 214 215 216

failure_cases = ['7sins-jfcs01e09-720p-bluray-x264']


echel0n's avatar
echel0n committed
217
class UnicodeTests(tests.SiCKRAGETestDBCase):
echel0n's avatar
echel0n committed
218 219
    def setUp(self):
        super(UnicodeTests, self).setUp()
220
        self.show = TVShow(1, 1, 'en')
221
        self.show.name = "The Big Bang Theory"
222
        self.show.save_to_db()
223

224
    def _test_unicode(self, name, result):
echel0n's avatar
echel0n committed
225
        np = NameParser(True, showObj=self.show, validate_show=False)
226
        parse_result = np.parse(name)
227

228
        # this shouldn't raise an exception
229 230
        repr(str(parse_result))
        self.assertEqual(parse_result.extra_info, result.extra_info)
231

232 233 234 235
    def test_unicode(self):
        for (name, result) in unicode_test_cases:
            self._test_unicode(name, result)

236

echel0n's avatar
echel0n committed
237
class FailureCaseTests(tests.SiCKRAGETestDBCase):
238 239
    @staticmethod
    def _test_name(name):
240
        np = NameParser(True)
241 242
        try:
            parse_result = np.parse(name)
243
        except (InvalidNameException, InvalidShowException):
244
            return True
245

246
        if VERBOSE:
247
            print('Actual: ', parse_result.which_regex, parse_result)
248
        return False
249

250 251 252 253
    def test_failures(self):
        for name in failure_cases:
            self.assertTrue(self._test_name(name))

254

echel0n's avatar
echel0n committed
255
class ComboTests(tests.SiCKRAGETestDBCase):
256 257
    def _test_combo(self, name, result, which_regexes):
        if VERBOSE:
258 259
            print()
            print('Testing', name)
260

echel0n's avatar
echel0n committed
261 262
        np = NameParser(True, validate_show=False)
        test_result = np.parse(name)
263

264
        if DEBUG:
265 266
            print(test_result, test_result.which_regex)
            print(result, which_regexes)
267

268 269 270 271 272 273 274 275 276
        self.assertEqual(test_result, result)
        for cur_regex in which_regexes:
            self.assertTrue(cur_regex in test_result.which_regex)
        self.assertEqual(len(which_regexes), len(test_result.which_regex))

    def test_combos(self):
        for (name, result, which_regexes) in combination_test_cases:
            # Normalise the paths. Converts UNIX-style paths into Windows-style
            # paths when test is run on Windows.
277
            self._test_combo(os.path.normpath(name), result, which_regexes)
278 279


echel0n's avatar
echel0n committed
280
class AnimeTests(tests.SiCKRAGETestDBCase):
echel0n's avatar
echel0n committed
281 282 283 284
    def setUp(self):
        super(AnimeTests, self).setUp()
        self.show = TVShow(1, 1, 'en')
        self.show.anime = True
285
        self.show.save_to_db()
echel0n's avatar
echel0n committed
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323

    def _test_names(self, np, section, transform=None, verbose=False):
        """
        Performs a test

        :param name_parser: to use for test
        :param section:
        :param transform:
        :param verbose:
        :return:
        """
        if VERBOSE or verbose:
            print()
            print('Running', section, 'tests')
        for cur_test_base in anime_test_cases[section]:
            if transform:
                cur_test = transform(cur_test_base)
                np.file_name = cur_test
            else:
                cur_test = cur_test_base
            if VERBOSE or verbose:
                print('Testing', cur_test)

            result = anime_test_cases[section][cur_test_base]
            np.showObj.name = result.series_name if result else None
            if not result:
                self.assertRaises(InvalidNameException, np.parse, cur_test)
                return
            else:
                result.which_regex = {section}
                test_result = np.parse(cur_test)

            if DEBUG or verbose:
                print('air_by_date:', test_result.is_air_by_date, 'air_date:', test_result.air_date)
                print('anime:', test_result.is_anime, 'ab_episode_numbers:', test_result.ab_episode_numbers)
                print(test_result)
                print(result)

324 325
            self.assertEqual(test_result.which_regex, {section},
                             '{} : {} != {}'.format(cur_test, test_result.which_regex, {section}))
echel0n's avatar
echel0n committed
326 327 328 329 330 331 332 333 334 335
            self.assertEqual(test_result, result, '{} : {} != {}'.format(cur_test, test_result, result))

    def test_anime_sxxexx_file_names(self):
        """
        Test anime SxxExx file names
        """
        np = NameParser(showObj=self.show, validate_show=False)
        self._test_names(np, 'anime_SxxExx', lambda x: x + '.avi')


echel0n's avatar
echel0n committed
336
class BasicTests(tests.SiCKRAGETestDBCase):
echel0n's avatar
echel0n committed
337
    def setUp(self):
338
        super(BasicTests, self).setUp()
339
        self.show = TVShow(1, 1, 'en')
340
        self.show.save_to_db()
341

342 343
    def _test_names(self, np, section, transform=None, verbose=False):
        if VERBOSE or verbose:
344
            print('Running', section, 'tests')
345 346 347
        for cur_test_base in simple_test_cases[section]:
            if transform:
                cur_test = transform(cur_test_base)
348
                np.file_name = cur_test
349 350 351
            else:
                cur_test = cur_test_base
            if VERBOSE or verbose:
352
                print('Testing', cur_test)
353 354

            result = simple_test_cases[section][cur_test_base]
echel0n's avatar
echel0n committed
355
            np.showObj.name = result.series_name if result else None
356
            if not result:
357
                self.assertRaises(InvalidNameException, np.parse, cur_test)
358 359
                return
            else:
echel0n's avatar
echel0n committed
360
                result.which_regex = {section}
361
                test_result = np.parse(cur_test)
362

363
            if DEBUG or verbose:
364 365 366 367
                print('air_by_date:', test_result.is_air_by_date, 'air_date:', test_result.air_date)
                print('anime:', test_result.is_anime, 'ab_episode_numbers:', test_result.ab_episode_numbers)
                print(test_result)
                print(result)
echel0n's avatar
echel0n committed
368
            self.assertEqual(test_result.which_regex, {section})
369 370 371
            self.assertEqual(str(test_result), str(result))

    def test_standard_names(self):
echel0n's avatar
echel0n committed
372
        np = NameParser(True, showObj=self.show, validate_show=False)
373 374 375
        self._test_names(np, 'standard')

    def test_standard_repeat_names(self):
echel0n's avatar
echel0n committed
376
        np = NameParser(False, showObj=self.show, validate_show=False)
377 378 379
        self._test_names(np, 'standard_repeat')

    def test_fov_names(self):
echel0n's avatar
echel0n committed
380
        np = NameParser(False, showObj=self.show, validate_show=False)
381 382 383
        self._test_names(np, 'fov')

    def test_fov_repeat_names(self):
echel0n's avatar
echel0n committed
384
        np = NameParser(False, showObj=self.show, validate_show=False)
385
        self._test_names(np, 'fov_repeat')
386

387
    def test_stupid_names(self):
echel0n's avatar
echel0n committed
388
        np = NameParser(False, showObj=self.show, validate_show=False)
389 390
        self._test_names(np, 'stupid')

echel0n's avatar
echel0n committed
391 392 393
    def test_no_season_names(self):
        np = NameParser(False, showObj=self.show, validate_show=False)
        self._test_names(np, 'no_season')
394 395

    def test_no_season_general_names(self):
echel0n's avatar
echel0n committed
396
        np = NameParser(False, showObj=self.show, validate_show=False)
397 398 399
        self._test_names(np, 'no_season_general')

    def test_no_season_multi_ep_names(self):
echel0n's avatar
echel0n committed
400
        np = NameParser(False, showObj=self.show, validate_show=False)
401 402 403
        self._test_names(np, 'no_season_multi_ep')

    def test_season_only_names(self):
echel0n's avatar
echel0n committed
404
        np = NameParser(False, showObj=self.show, validate_show=False)
405 406 407
        self._test_names(np, 'season_only')

    def test_standard_file_names(self):
echel0n's avatar
echel0n committed
408
        np = NameParser(showObj=self.show, validate_show=False)
409 410 411
        self._test_names(np, 'standard', lambda x: x + '.avi')

    def test_standard_repeat_file_names(self):
echel0n's avatar
echel0n committed
412
        np = NameParser(showObj=self.show, validate_show=False)
413 414 415
        self._test_names(np, 'standard_repeat', lambda x: x + '.avi')

    def test_fov_file_names(self):
echel0n's avatar
echel0n committed
416
        np = NameParser(showObj=self.show, validate_show=False)
417 418 419
        self._test_names(np, 'fov', lambda x: x + '.avi')

    def test_fov_repeat_file_names(self):
echel0n's avatar
echel0n committed
420
        np = NameParser(showObj=self.show, validate_show=False)
421 422 423
        self._test_names(np, 'fov_repeat', lambda x: x + '.avi')

    def test_stupid_file_names(self):
echel0n's avatar
echel0n committed
424
        np = NameParser(showObj=self.show, validate_show=False)
425 426
        self._test_names(np, 'stupid', lambda x: x + '.avi')

echel0n's avatar
echel0n committed
427 428 429
    def test_no_season_file_names(self):
        np = NameParser(showObj=self.show, validate_show=False)
        self._test_names(np, 'no_season', lambda x: x + '.avi')
430 431

    def test_no_season_general_file_names(self):
echel0n's avatar
echel0n committed
432
        np = NameParser(showObj=self.show, validate_show=False)
433 434 435
        self._test_names(np, 'no_season_general', lambda x: x + '.avi')

    def test_no_season_multi_ep_file_names(self):
echel0n's avatar
echel0n committed
436
        np = NameParser(showObj=self.show, validate_show=False)
437 438 439
        self._test_names(np, 'no_season_multi_ep', lambda x: x + '.avi')

    def test_season_only_file_names(self):
echel0n's avatar
echel0n committed
440
        np = NameParser(showObj=self.show, validate_show=False)
441 442
        self._test_names(np, 'season_only', lambda x: x + '.avi')

443 444 445
    def test_combination_names(self):
        pass

446

447
if __name__ == '__main__':
448 449 450 451
    print("==================")
    print("STARTING - NAME PARSER TESTS")
    print("==================")
    print("######################################################################")
452
    unittest.main()