From 9993976ae436c62ef86c2c45f0f001e5f7e471bd Mon Sep 17 00:00:00 2001 From: gcmalloc Date: Fri, 28 Sep 2012 14:06:37 +0200 Subject: [PATCH] correction on the sanitize title method, change in title resulting --- test/test_div.py | 29 ----------------------------- test/test_utils.py | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 29 deletions(-) delete mode 100644 test/test_div.py create mode 100644 test/test_utils.py diff --git a/test/test_div.py b/test/test_div.py deleted file mode 100644 index 4d4819b3c..000000000 --- a/test/test_div.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- - -# Various small unit tests - -import os,sys -sys.path.append(os.path.dirname(os.path.dirname(__file__))) - -import youtube_dl - -def test_simplify_title(): - assert youtube_dl._simplify_title(u'abc') == u'abc' - assert youtube_dl._simplify_title(u'abc_d-e') == u'abc_d-e' - - assert youtube_dl._simplify_title(u'123') == u'123' - - assert u'/' not in youtube_dl._simplify_title(u'abc/de') - assert u'abc' in youtube_dl._simplify_title(u'abc/de') - assert u'de' in youtube_dl._simplify_title(u'abc/de') - assert u'/' not in youtube_dl._simplify_title(u'abc/de///') - - assert u'\\' not in youtube_dl._simplify_title(u'abc\\de') - assert u'abc' in youtube_dl._simplify_title(u'abc\\de') - assert u'de' in youtube_dl._simplify_title(u'abc\\de') - - assert youtube_dl._simplify_title(u'ä') == u'ä' - assert youtube_dl._simplify_title(u'кириллица') == u'кириллица' - - # Strip underlines - assert youtube_dl._simplify_title(u'\'a_') == u'a' 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'кириллица' -- 2.40.0