diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-12-23 06:44:42 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-12-23 06:49:16 +0530 |
commit | e0fd95737d1a3c4a2bfb470c5408a396c8545ca5 (patch) | |
tree | 8c47cd22bc2b96b4b70c97b2854cd84756fe6b5e /test/test_YoutubeDL.py | |
parent | 4ac5b94807e75dc750459b8db6aa95d3b5275a1b (diff) | |
download | hypervideo-pre-e0fd95737d1a3c4a2bfb470c5408a396c8545ca5.tar.lz hypervideo-pre-e0fd95737d1a3c4a2bfb470c5408a396c8545ca5.tar.xz hypervideo-pre-e0fd95737d1a3c4a2bfb470c5408a396c8545ca5.zip |
[outtmpl] Add alternate forms `F`, `D`
and improve `id` detection
F = sanitize as filename (# = restricted)
D = add Decimal suffixes
Closes #2085, 2081
Diffstat (limited to 'test/test_YoutubeDL.py')
-rw-r--r-- | test/test_YoutubeDL.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/test/test_YoutubeDL.py b/test/test_YoutubeDL.py index 6c2530046..39d7e1ec5 100644 --- a/test/test_YoutubeDL.py +++ b/test/test_YoutubeDL.py @@ -717,6 +717,7 @@ class TestYoutubeDL(unittest.TestCase): test('%(id)s', '.abcd', info={'id': '.abcd'}) test('%(id)s', 'ab__cd', info={'id': 'ab__cd'}) test('%(id)s', ('ab:cd', 'ab -cd'), info={'id': 'ab:cd'}) + test('%(id.0)s', '-', info={'id': '--'}) # Invalid templates self.assertTrue(isinstance(YoutubeDL.validate_outtmpl('%(title)'), ValueError)) @@ -777,6 +778,10 @@ class TestYoutubeDL(unittest.TestCase): test('%(title5)#U', 'a\u0301e\u0301i\u0301 𝐀') test('%(title5)+U', 'áéí A') test('%(title5)+#U', 'a\u0301e\u0301i\u0301 A') + test('%(height)D', '1K') + test('%(height)5.2D', ' 1.08K') + test('%(title4).10F', ('foo \'bar\' ', 'foo \'bar\'#')) + test('%(title4)#F', 'foo_bar_test') if compat_os_name == 'nt': test('%(title4)q', ('"foo \\"bar\\" test"', "'foo _'bar_' test'")) test('%(formats.:.id)#q', ('"id 1" "id 2" "id 3"', "'id 1' 'id 2' 'id 3'")) @@ -808,6 +813,11 @@ class TestYoutubeDL(unittest.TestCase): test('%(width-100,height+width|def)s', 'def') test('%(timestamp-x>%H\\,%M\\,%S,timestamp>%H\\,%M\\,%S)s', '12,00,00') + # Replacement + test('%(id&foo)s.bar', 'foo.bar') + test('%(title&foo)s.bar', 'NA.bar') + test('%(title&foo|baz)s.bar', 'baz.bar') + # Laziness def gen(): yield from range(5) @@ -836,11 +846,6 @@ class TestYoutubeDL(unittest.TestCase): test('%(title3)s', ('foo/bar\\test', 'foo_bar_test')) test('folder/%(title3)s', ('folder/foo/bar\\test', 'folder%sfoo_bar_test' % os.path.sep)) - # Replacement - test('%(id&foo)s.bar', 'foo.bar') - test('%(title&foo)s.bar', 'NA.bar') - test('%(title&foo|baz)s.bar', 'baz.bar') - def test_format_note(self): ydl = YoutubeDL() self.assertEqual(ydl._format_note({}), '') |