aboutsummaryrefslogtreecommitdiff
path: root/test/test_utils.py
diff options
context:
space:
mode:
authorFilippo Valsorda <filippo.valsorda@gmail.com>2012-11-29 15:38:07 +0100
committerFilippo Valsorda <filippo.valsorda@gmail.com>2012-11-29 15:38:07 +0100
commit8192ebe1f874b22b0c27e675a4136a06e46a68ce (patch)
tree43e0feda4e3381d0c9455a7760093533d47145a5 /test/test_utils.py
parentcaaa47d37215f498c033afb42972c135be8138d4 (diff)
parent20ba04267c3c2be27a766a43f34014012799b761 (diff)
Merge remote-tracking branch 'origin/master' into fork_master
New tests - merged with md5 correction
Diffstat (limited to 'test/test_utils.py')
-rw-r--r--test/test_utils.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/test/test_utils.py b/test/test_utils.py
index ceefabefc..fd8190f51 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -13,11 +13,12 @@ from youtube_dl.utils import sanitize_filename
from youtube_dl.utils import unescapeHTML
from youtube_dl.utils import orderedSet
-if sys.version_info < (3,0):
+if sys.version_info < (3, 0):
_compat_str = lambda b: b.decode('unicode-escape')
else:
_compat_str = lambda s: s
+
class TestUtil(unittest.TestCase):
def test_timeconvert(self):
self.assertTrue(timeconvert('') is None)
@@ -62,11 +63,11 @@ class TestUtil(unittest.TestCase):
self.assertEqual('yes_no', sanitize_filename('yes? no', restricted=True))
self.assertEqual('this_-_that', sanitize_filename('this: that', restricted=True))
- tests =_compat_str('a\xe4b\u4e2d\u56fd\u7684c')
+ tests = _compat_str('a\xe4b\u4e2d\u56fd\u7684c')
self.assertEqual(sanitize_filename(tests, restricted=True), 'a_b_c')
- self.assertTrue(sanitize_filename(_compat_str('\xf6'), restricted=True) != '') # No empty filename
+ self.assertTrue(sanitize_filename(_compat_str('\xf6'), restricted=True) != '') # No empty filename
- forbidden = '"\0\\/&!: \'\t\n'
+ forbidden = '"\0\\/&!: \'\t\n()[]{}$;`^,#'
for fc in forbidden:
for fbc in forbidden:
self.assertTrue(fbc not in sanitize_filename(fc, restricted=True))
@@ -79,11 +80,11 @@ class TestUtil(unittest.TestCase):
self.assertTrue(sanitize_filename(':', restricted=True) != '')
def test_ordered_set(self):
- self.assertEqual(orderedSet([1,1,2,3,4,4,5,6,7,3,5]), [1,2,3,4,5,6,7])
+ self.assertEqual(orderedSet([1, 1, 2, 3, 4, 4, 5, 6, 7, 3, 5]), [1, 2, 3, 4, 5, 6, 7])
self.assertEqual(orderedSet([]), [])
self.assertEqual(orderedSet([1]), [1])
#keep the list ordered
- self.assertEqual(orderedSet([135,1,1,1]), [135,1])
+ self.assertEqual(orderedSet([135, 1, 1, 1]), [135, 1])
def test_unescape_html(self):
self.assertEqual(unescapeHTML(_compat_str('%20;')), _compat_str('%20;'))