Browse Source

Fix some of the unit tests

tags/release_0.1.0
Adam 11 years ago
parent
commit
f0d8bcb62c
  1. 3
      sickbeard/common.py
  2. 8
      tests/scene_helpers_tests.py
  3. 8
      tests/xem_tests.py

3
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

8
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

8
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<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))
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__":

Loading…
Cancel
Save