2011-11-21 20:07:24 +01:00
|
|
|
# -*- 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():
|
2011-11-21 20:15:32 +01:00
|
|
|
assert youtube_dl._simplify_title(u'abc') == u'abc'
|
|
|
|
assert youtube_dl._simplify_title(u'abc_d-e') == u'abc_d-e'
|
2011-11-21 20:07:24 +01:00
|
|
|
|
2011-11-21 20:15:32 +01:00
|
|
|
assert youtube_dl._simplify_title(u'123') == u'123'
|
2011-11-21 20:07:24 +01:00
|
|
|
|
2011-11-21 20:15:32 +01:00
|
|
|
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')
|
2011-11-21 21:50:39 +01:00
|
|
|
assert u'/' not in youtube_dl._simplify_title(u'abc/de///')
|
2011-11-21 20:07:24 +01:00
|
|
|
|
2011-11-21 20:15:32 +01:00
|
|
|
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')
|
|
|
|
|
2011-11-21 21:50:39 +01:00
|
|
|
assert youtube_dl._simplify_title(u'ä') == u'ä'
|
|
|
|
assert youtube_dl._simplify_title(u'кириллица') == u'кириллица'
|
2011-11-21 20:15:32 +01:00
|
|
|
|
|
|
|
# Strip underlines
|
|
|
|
assert youtube_dl._simplify_title(u'\'a_') == u'a'
|