From f0d8bcb62c7ce19f7e082a2e35784c464ace838c Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 16 Sep 2014 17:57:13 +0800 Subject: [PATCH] Fix some of the unit tests --- sickbeard/common.py | 3 ++- tests/scene_helpers_tests.py | 8 ++++---- tests/xem_tests.py | 8 ++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/sickbeard/common.py b/sickbeard/common.py index ca945555..d646617f 100644 --- a/sickbeard/common.py +++ b/sickbeard/common.py @@ -205,7 +205,8 @@ class Quality: else: return Quality.UNKNOWN - if checkName(["(pdtv|hdtv|dsr|tvrip).(xvid|x264|h.?264)"], all) and not checkName(["(720|1080)[pi]"], all): + if checkName(["(pdtv|hdtv|dsr|tvrip).(xvid|x264|h.?264)"], all) and not checkName(["(720|1080)[pi]"], all) and\ + not checkName(["hr.ws.pdtv.x264"], any): return Quality.SDTV elif checkName(["web.dl|webrip", "xvid|x264|h.?264"], all) and not checkName(["(720|1080)[pi]"], all): return Quality.SDTV diff --git a/tests/scene_helpers_tests.py b/tests/scene_helpers_tests.py index 68fec0e2..e9abd7fb 100644 --- a/tests/scene_helpers_tests.py +++ b/tests/scene_helpers_tests.py @@ -100,12 +100,12 @@ class SceneExceptionTestCase(test.SickbeardTestDBCase): self.assertEqual(sorted(scene_exceptions.get_scene_exceptions(70726)), ['Babylon 5', 'Babylon5']) def test_sceneExceptionByName(self): - self.assertEqual(scene_exceptions.get_scene_exception_by_name('Babylon5'), 70726) - self.assertEqual(scene_exceptions.get_scene_exception_by_name('babylon 5'), 70726) - self.assertEqual(scene_exceptions.get_scene_exception_by_name('Carlos 2010'), 164451) + self.assertEqual(scene_exceptions.get_scene_exception_by_name('Babylon5'), (70726, -1)) + self.assertEqual(scene_exceptions.get_scene_exception_by_name('babylon 5'), (70726, -1)) + self.assertEqual(scene_exceptions.get_scene_exception_by_name('Carlos 2010'), (164451, -1)) def test_sceneExceptionByNameEmpty(self): - self.assertEqual(scene_exceptions.get_scene_exception_by_name('nothing useful'), None) + self.assertEqual(scene_exceptions.get_scene_exception_by_name('nothing useful'), (None, None)) def test_sceneExceptionsResetNameCache(self): # clear the exceptions diff --git a/tests/xem_tests.py b/tests/xem_tests.py index c4ef196d..a2b26579 100644 --- a/tests/xem_tests.py +++ b/tests/xem_tests.py @@ -68,15 +68,15 @@ class XEMBasicTests(test.SickbeardTestDBCase): name = "Game.of.Thrones.S03.720p.HDTV.x264-CtrlHD" release = "Game of Thrones" - m = re.match('(?P(?>\d{1,3})(?![ip])).+', name) + # m = re.match('(?P(?>\d{1,3})(?![ip])).+', name) escaped_name = re.sub('\\\\[\\s.-]', '\W+', re.escape(release)) curRegex = '^' + escaped_name + '\W+(?:(?:S\d[\dE._ -])|(?:\d\d?x)|(?:\d{4}\W\d\d\W\d\d)|(?:(?:part|pt)[\._ -]?(\d|[ivx]))|Season\W+\d+\W+|E\d+\W+|(?:\d{1,3}.+\d{1,}[a-zA-Z]{2}\W+[a-zA-Z]{3,}\W+\d{4}.+))' - print(u"Checking if show " + name + " matches " + curRegex) + # print(u"Checking if show " + name + " matches " + curRegex) match = re.search(curRegex, name, re.I) - if match: - print(u"Matched " + curRegex + " to " + name) + # if match: + # print(u"Matched " + curRegex + " to " + name) if __name__ == "__main__":