Skip to content

Commit

Permalink
Updated the encoding test to generate its data rather than having it …
Browse files Browse the repository at this point in the history
…checked into git
  • Loading branch information
midgetspy committed Jul 17, 2012
1 parent 093e983 commit f913c47
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 44 deletions.
23 changes: 19 additions & 4 deletions tests/encodingTests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# coding=UTF-8

import unittest
import sys, os, locale

Expand All @@ -18,18 +20,31 @@

class EncodingTests(unittest.TestCase):

test_filename = u'test.\xee\xe2\xe9\xe8.txt'
test_path_unicode = u'test_data' + os.sep + u'encoding_tests'
test_path_bytestring = str(test_path_unicode)

def setUp(self):
print "setting up"
f = open(self.test_path_unicode + os.sep + self.test_filename, 'w')
f.write('test data')
f.close()

def tearDown(self):
os.remove(self.test_path_unicode + os.sep + self.test_filename)

def test_unicode(self):
ufiles = os.listdir(u'test_data\\encoding_tests')
files = os.listdir('test_data\\encoding_tests')
ufiles = os.listdir(self.test_path_unicode)
files = os.listdir(self.test_path_bytestring)

print
print 'Testing that the encoding', sickbeard.SYS_ENCODING, 'behaves as we expect it would'

self.assertEqual(ufiles[0], files[0].decode(sickbeard.SYS_ENCODING))

def test_ek(self):
str_file = ek.ek(os.listdir, 'test_data\\encoding_tests')[0]
unicode_file = ek.ek(os.listdir, u'test_data\\encoding_tests')[0]
str_file = ek.ek(os.listdir, self.test_path_bytestring)[0]
unicode_file = ek.ek(os.listdir, self.test_path_unicode)[0]

# no matter if we give unicode or not we should get unicode back
self.assertEqual(u'test.\xee\xe2\xe9\xe8.txt', unicode_file)
Expand Down
40 changes: 0 additions & 40 deletions tests/test_data/encoding_tests/test.îâéè.txt

This file was deleted.

0 comments on commit f913c47

Please sign in to comment.