mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-01 00:43:37 +00:00
Fix some of the unit tests
This commit is contained in:
parent
9e20c33013
commit
f0d8bcb62c
3 changed files with 10 additions and 9 deletions
|
@ -205,7 +205,8 @@ class Quality:
|
||||||
else:
|
else:
|
||||||
return Quality.UNKNOWN
|
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
|
return Quality.SDTV
|
||||||
elif checkName(["web.dl|webrip", "xvid|x264|h.?264"], all) and not checkName(["(720|1080)[pi]"], all):
|
elif checkName(["web.dl|webrip", "xvid|x264|h.?264"], all) and not checkName(["(720|1080)[pi]"], all):
|
||||||
return Quality.SDTV
|
return Quality.SDTV
|
||||||
|
|
|
@ -100,12 +100,12 @@ class SceneExceptionTestCase(test.SickbeardTestDBCase):
|
||||||
self.assertEqual(sorted(scene_exceptions.get_scene_exceptions(70726)), ['Babylon 5', 'Babylon5'])
|
self.assertEqual(sorted(scene_exceptions.get_scene_exceptions(70726)), ['Babylon 5', 'Babylon5'])
|
||||||
|
|
||||||
def test_sceneExceptionByName(self):
|
def test_sceneExceptionByName(self):
|
||||||
self.assertEqual(scene_exceptions.get_scene_exception_by_name('Babylon5'), 70726)
|
self.assertEqual(scene_exceptions.get_scene_exception_by_name('Babylon5'), (70726, -1))
|
||||||
self.assertEqual(scene_exceptions.get_scene_exception_by_name('babylon 5'), 70726)
|
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)
|
self.assertEqual(scene_exceptions.get_scene_exception_by_name('Carlos 2010'), (164451, -1))
|
||||||
|
|
||||||
def test_sceneExceptionByNameEmpty(self):
|
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):
|
def test_sceneExceptionsResetNameCache(self):
|
||||||
# clear the exceptions
|
# clear the exceptions
|
||||||
|
|
|
@ -68,15 +68,15 @@ class XEMBasicTests(test.SickbeardTestDBCase):
|
||||||
name = "Game.of.Thrones.S03.720p.HDTV.x264-CtrlHD"
|
name = "Game.of.Thrones.S03.720p.HDTV.x264-CtrlHD"
|
||||||
release = "Game of Thrones"
|
release = "Game of Thrones"
|
||||||
|
|
||||||
m = re.match('(?P<ep_ab_num>(?>\d{1,3})(?![ip])).+', name)
|
# m = re.match('(?P<ep_ab_num>(?>\d{1,3})(?![ip])).+', name)
|
||||||
|
|
||||||
escaped_name = re.sub('\\\\[\\s.-]', '\W+', re.escape(release))
|
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}.+))'
|
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)
|
match = re.search(curRegex, name, re.I)
|
||||||
if match:
|
# if match:
|
||||||
print(u"Matched " + curRegex + " to " + name)
|
# print(u"Matched " + curRegex + " to " + name)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in a new issue