Refactor, update tests

This commit is contained in:
7x11x13
2025-01-08 13:29:18 -05:00
parent 25dca22cb7
commit ac69f9474b
3 changed files with 11 additions and 15 deletions
+2 -2
View File
@@ -714,7 +714,7 @@ class TestYoutubeDL(unittest.TestCase):
def test_prepare_outtmpl_and_filename(self):
def test(tmpl, expected, *, info=None, **params):
if 'trim_file_name' not in params:
params['trim_file_name'] = 0 # disable trimming
params['trim_file_name'] = 'notrim' # disable trimming
params['outtmpl'] = tmpl
ydl = FakeYDL(params)
ydl._num_downloads = 1
@@ -935,7 +935,7 @@ class TestYoutubeDL(unittest.TestCase):
test('%(title6)s.%(ext)s', '' * 3 + '.mp4', trim_file_name='11b', filesystem_encoding='utf-8')
test('%(title6)s.%(ext)s', '' * 4 + '.mp4', trim_file_name='12b', filesystem_encoding='utf-8')
test('%(title6)s.%(ext)s', '' * 6 + '.mp4', trim_file_name='12b', filesystem_encoding='utf-16le')
test('folder/%(title6)s.%(ext)s', f'folder{os.path.sep}あああ.mp4', trim_file_name='3c')
test('folder/%(title6)s.%(ext)s', f'fol{os.path.sep}あああ.mp4', trim_file_name='3c')
def test_format_note(self):
ydl = YoutubeDL()