aboutsummaryrefslogtreecommitdiff
path: root/test/test_utils.py
diff options
context:
space:
mode:
authorgcmalloc <gcmalloc@gmail.com>2012-09-28 14:06:37 +0200
committergcmalloc <gcmalloc@gmail.com>2012-10-12 20:24:58 +0200
commit9993976ae436c62ef86c2c45f0f001e5f7e471bd (patch)
treeaacfd7c0ee4c00d861d284466ff9e0bcdc4a42ff /test/test_utils.py
parentb387fb0385444da4564b64e079ad1d2bba1e9e16 (diff)
correction on the sanitize title method, change in title resulting
Diffstat (limited to 'test/test_utils.py')
-rw-r--r--test/test_utils.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py
new file mode 100644
index 000000000..614ef1b03
--- /dev/null
+++ b/test/test_utils.py
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+
+# Various small unit tests
+
+from youtube_dl.utils import sanitize_filename
+
+def test_sanitize_filename():
+ assert sanitize_filename(u'abc') == u'abc'
+ assert sanitize_filename(u'abc_d-e') == u'abc_d-e'
+
+ assert sanitize_filename(u'123') == u'123'
+
+ assert u'/' not in sanitize_filename(u'abc/de')
+ assert u'abc' in sanitize_filename(u'abc/de')
+ assert u'de' in sanitize_filename(u'abc/de')
+ assert u'/' not in sanitize_filename(u'abc/de///')
+
+ assert u'\\' not in sanitize_filename(u'abc\\de')
+ assert u'abc' in sanitize_filename(u'abc\\de')
+ assert u'de' in sanitize_filename(u'abc\\de')
+
+ assert sanitize_filename(u'ä') == u'ä'
+ assert sanitize_filename(u'кириллица') == u'кириллица'