2014-12-05 23:13:50 -05:00
|
|
|
# coding=utf-8
|
2014-12-05 21:46:44 -05:00
|
|
|
import unittest
|
|
|
|
import sys, os.path
|
|
|
|
|
|
|
|
sys.path.append(os.path.abspath('..'))
|
|
|
|
sys.path.append(os.path.abspath('../lib'))
|
|
|
|
|
|
|
|
import sickbeard
|
2014-12-05 23:13:50 -05:00
|
|
|
from sickbeard import encodingKludge as ek
|
2014-12-05 21:46:44 -05:00
|
|
|
from sickbeard.exceptions import ex
|
|
|
|
|
|
|
|
sickbeard.SYS_ENCODING = 'UTF-8'
|
|
|
|
|
|
|
|
DEBUG = VERBOSE = False
|
|
|
|
|
|
|
|
class EncodingTests(unittest.TestCase):
|
|
|
|
def test_encoding(self):
|
2014-12-08 07:48:35 -05:00
|
|
|
strings = [u'הערוץ הראשון', 'Les Enfants De La Télé', u'\x89']
|
2014-12-05 23:13:50 -05:00
|
|
|
|
|
|
|
for s in strings:
|
|
|
|
try:
|
|
|
|
print ek.ss(s)
|
2014-12-08 07:48:35 -05:00
|
|
|
print unicode(s).decode('UTF-8')
|
2014-12-05 23:13:50 -05:00
|
|
|
except Exception, e:
|
|
|
|
print ex(e)
|
2014-12-05 21:46:44 -05:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
print "=================="
|
|
|
|
print "STARTING - Encoding TESTS"
|
|
|
|
print "=================="
|
|
|
|
print "######################################################################"
|
|
|
|
suite = unittest.TestLoader().loadTestsFromTestCase(EncodingTests)
|