mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-07 20:30:41 -05:00
correction on the sanitize title method, change in title resulting
This commit is contained in:
parent
b387fb0385
commit
9993976ae4
2 changed files with 23 additions and 29 deletions
|
@ -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'
|
|
23
test/test_utils.py
Normal file
23
test/test_utils.py
Normal file
|
@ -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'кириллица'
|
Loading…
Reference in a new issue