Private GIT

Skip to content
Snippets Groups Projects
Commit 98c162d9 authored by labrys's avatar labrys
Browse files

Lint 10/10

parent b73111ae
Branches
Tags
No related merge requests found
# coding=utf-8 # coding=utf-8
import sys, os.path """
Test encoding
"""
sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), '../lib'))) # pylint: disable=line-too-long
sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import sys
import os.path
import locale import locale
import unittest import unittest
sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), '../lib')))
sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import sickbeard import sickbeard
from sickrage.helper.common import sanitize_filename from sickrage.helper.common import sanitize_filename
from sickrage.helper.encoding import ek from sickrage.helper.encoding import ek
...@@ -15,8 +21,14 @@ from sickrage.helper.exceptions import ex ...@@ -15,8 +21,14 @@ from sickrage.helper.exceptions import ex
class EncodingTests(unittest.TestCase): class EncodingTests(unittest.TestCase):
"""
Test encodings
"""
def test_encoding(self): def test_encoding(self):
rootDir = 'C:\\Temp\\TV' """
Test encoding
"""
root_dir = 'C:\\Temp\\TV'
strings = [u'Les Enfants De La T\xe9l\xe9', u'RT� One'] strings = [u'Les Enfants De La T\xe9l\xe9', u'RT� One']
sickbeard.SYS_ENCODING = None sickbeard.SYS_ENCODING = None
...@@ -31,17 +43,18 @@ class EncodingTests(unittest.TestCase): ...@@ -31,17 +43,18 @@ class EncodingTests(unittest.TestCase):
if not sickbeard.SYS_ENCODING or sickbeard.SYS_ENCODING in ('ANSI_X3.4-1968', 'US-ASCII', 'ASCII'): if not sickbeard.SYS_ENCODING or sickbeard.SYS_ENCODING in ('ANSI_X3.4-1968', 'US-ASCII', 'ASCII'):
sickbeard.SYS_ENCODING = 'UTF-8' sickbeard.SYS_ENCODING = 'UTF-8'
for s in strings: for test in strings:
try: try:
show_dir = ek(os.path.join, rootDir, sanitize_filename(s)) show_dir = ek(os.path.join, root_dir, sanitize_filename(test))
self.assertTrue(isinstance(show_dir, unicode)) self.assertTrue(isinstance(show_dir, unicode))
except Exception, e: except Exception as error: # pylint: disable=broad-except
ex(e) ex(error)
if __name__ == "__main__": if __name__ == "__main__":
print "==================" print "=================="
print "STARTING - ENCODING TESTS" print "STARTING - ENCODING TESTS"
print "==================" print "=================="
print "######################################################################" print "######################################################################"
suite = unittest.TestLoader().loadTestsFromTestCase(EncodingTests)
unittest.TextTestRunner(verbosity=2).run(suite) SUITE = unittest.TestLoader().loadTestsFromTestCase(EncodingTests)
unittest.TextTestRunner(verbosity=2).run(SUITE)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment