Merge branch 'master' into develop

This commit is contained in:
JackDandy 2018-05-14 02:56:32 +01:00
commit 4eb3cdf14e
2 changed files with 33 additions and 14 deletions

View file

@ -9,6 +9,11 @@
### 0.16.7 (2018-05-14 02:40:00 UTC)
* Fix name_parser_tests for test_extra_info_no_name
### 0.16.6 (2018-05-14 01:00:00 UTC) ### 0.16.6 (2018-05-14 01:00:00 UTC)
* Change improve tolerance to parse a release title with a badly placed episode name * Change improve tolerance to parse a release title with a badly placed episode name

View file

@ -374,13 +374,13 @@ extra_info_no_name_tests = [('The Show Name', [('Episode 302', 3, 2)],
'The.Show.Name.S03E02E03.720p.AMZN.WEBRip.DDP5.1.x264-GROUP', 'The.Show.Name.S03E02E03.720p.AMZN.WEBRip.DDP5.1.x264-GROUP',
'720p.AMZN.WEBRip.DDP5.1.x264'), '720p.AMZN.WEBRip.DDP5.1.x264'),
('The Show Name', [('Episode 302', 3, 2), ('Name 2', 3, 3)], ('The Show Name', [('Episode 302', 3, 2), ('Name 2', 3, 3)],
'The.Show.Name.S03E02E03.Episode.302.Name2.720p.AMZN.WEBRip.DDP5.1.x264-GROUP', 'The.Show.Name.S03E02E03.Episode.302.Name.2.720p.AMZN.WEBRip.DDP5.1.x264-GROUP',
'720p.AMZN.WEBRip.DDP5.1.x264'), '720p.AMZN.WEBRip.DDP5.1.x264'),
('The Show Name', [('Episode 302', 3, 2), ('Name 2', 3, 3)], ('The Show Name', [('Episode 302', 3, 2), ('Name 2', 3, 3)],
'The.Show.Name.S03E02E03.REPACK.Episode.302.Name2.720p.AMZN.WEBRip.DDP5.1.x264-GROUP', 'The.Show.Name.S03E02E03.REPACK.Episode.302.Name.2.720p.AMZN.WEBRip.DDP5.1.x264-GROUP',
'REPACK.720p.AMZN.WEBRip.DDP5.1.x264'), 'REPACK.720p.AMZN.WEBRip.DDP5.1.x264'),
('The Show Name', [('Episode 302', 3, 2), ('Name 2', 3, 3)], ('The Show Name', [('Episode 302', 3, 2), ('Name 2', 3, 3)],
'The.Show.Name.S03E02E03.Episode.302.Name2.REPACK.720p.AMZN.WEBRip.DDP5.1.x264-GROUP', 'The.Show.Name.S03E02E03.Episode.302.Name.2.REPACK.720p.AMZN.WEBRip.DDP5.1.x264-GROUP',
'REPACK.720p.AMZN.WEBRip.DDP5.1.x264'), 'REPACK.720p.AMZN.WEBRip.DDP5.1.x264'),
] ]
@ -656,20 +656,34 @@ class TVEpisode(tv.TVEpisode):
class ExtraInfoNoNameTests(test.SickbeardTestDBCase): class ExtraInfoNoNameTests(test.SickbeardTestDBCase):
def setUp(self):
super(ExtraInfoNoNameTests, self).setUp()
self.oldregex = parser.regex
def tearDown(self):
super(ExtraInfoNoNameTests, self).tearDown()
parser.regex = self.oldregex
def test_extra_info_no_name(self): def test_extra_info_no_name(self):
for case in extra_info_no_name_tests: for i in range(2):
tvs = TVShow(False, case[0], 2, 1) if 1 == i:
for e in case[1]: if None is parser.regex:
tvs.episodes.setdefault(e[1], {}).update({e[2]: TVEpisode(e[0])}) # only retest if regex lib is installed, now test re lib
continue
parser.regex = None
for case in extra_info_no_name_tests:
tvs = TVShow(False, case[0], 2, 1)
for e in case[1]:
tvs.episodes.setdefault(e[1], {}).update({e[2]: TVEpisode(e[0])})
sickbeard.showList = [tvs] sickbeard.showList = [tvs]
name_cache.nameCache = {} name_cache.nameCache = {}
name_cache.buildNameCache() name_cache.buildNameCache()
np = parser.NameParser() np = parser.NameParser()
r = np.parse(case[2]) r = np.parse(case[2], cache_result=False)
n_ep = r.extra_info_no_name() n_ep = r.extra_info_no_name()
self.assertEqual(n_ep, case[3]) self.assertEqual(n_ep, case[3])
if __name__ == '__main__': if __name__ == '__main__':