From f913c473188e36efc3b80668a0fef9cc4012e408 Mon Sep 17 00:00:00 2001 From: Nic Wolfe Date: Mon, 16 Jul 2012 22:25:19 -0600 Subject: [PATCH] Updated the encoding test to generate its data rather than having it checked into git --- tests/encodingTests.py | 23 +++++++++-- .../encoding_tests/test.\356\342\351\350.txt" | 40 ------------------- 2 files changed, 19 insertions(+), 44 deletions(-) delete mode 100644 "tests/test_data/encoding_tests/test.\356\342\351\350.txt" diff --git a/tests/encodingTests.py b/tests/encodingTests.py index 48bbf38b79..40402f189b 100644 --- a/tests/encodingTests.py +++ b/tests/encodingTests.py @@ -1,3 +1,5 @@ +# coding=UTF-8 + import unittest import sys, os, locale @@ -18,9 +20,22 @@ 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' @@ -28,8 +43,8 @@ def test_unicode(self): 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) diff --git "a/tests/test_data/encoding_tests/test.\356\342\351\350.txt" "b/tests/test_data/encoding_tests/test.\356\342\351\350.txt" deleted file mode 100644 index 529debd1f3..0000000000 --- "a/tests/test_data/encoding_tests/test.\356\342\351\350.txt" +++ /dev/null @@ -1,40 +0,0 @@ -Episode Naming - -Show Name %SN Show Name - %S.N Show.Name - %S_N Show_Name -Episode Name %EN Episode Name - %E.N Episode.Name - %E_N Episode_Name -Season Number %S 1 - %0S 01 -Episode Number %E 5 - %0E 05 -Quality %Q 720p BluRay - -Use lower case if you want lower case names (eg. %sn, %e.n, %q etc) - -Date format: -- 2010-11-23 -- 2010.11.23 -- 2010_11_23 -- 2010 11 23 - -Multi-ep: -- repeat (1x2x3x4) -- extend (1x2-3-4) -- duplicate (1x2 1x3 1x4) - -PP-only stuff: - -%OF Original_File_Name -%RG Release_Group - - -Validation: -- season/episode can only occur once -- episode MUST occur once - -Also: -- remove season folder option, require users to put it in the ep naming -- on rename, show proposed changes and ask about folder sorting too \ No newline at end of file