aboutsummaryrefslogtreecommitdiff
path: root/test/test_utils.py
blob: 614ef1b03afb429f8c62f192a3c227b207e38032 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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'кириллица'