diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-11-08 21:17:57 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-11-10 04:19:42 +0530 |
commit | 4476d2c7649b622834d9f3b116c3ccd094061d22 (patch) | |
tree | d8f5886af2a84eca1d7d99f1e32e64452113bbd4 /test/test_YoutubeDL.py | |
parent | aa9369a2d84e4e05f4a8be16c85afc7ee2e902bd (diff) | |
download | hypervideo-pre-4476d2c7649b622834d9f3b116c3ccd094061d22.tar.lz hypervideo-pre-4476d2c7649b622834d9f3b116c3ccd094061d22.tar.xz hypervideo-pre-4476d2c7649b622834d9f3b116c3ccd094061d22.zip |
[outtmpl] Add alternate forms for `q` and `j`
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 40c4169c8..5a0dabeb6 100644 --- a/test/test_YoutubeDL.py +++ b/test/test_YoutubeDL.py @@ -656,7 +656,7 @@ class TestYoutubeDL(unittest.TestCase): 'playlist_autonumber': 2, '_last_playlist_index': 100, 'n_entries': 10, - 'formats': [{'id': 'id1'}, {'id': 'id2'}, {'id': 'id3'}] + 'formats': [{'id': 'id 1'}, {'id': 'id 2'}, {'id': 'id 3'}] } def test_prepare_outtmpl_and_filename(self): @@ -763,14 +763,15 @@ class TestYoutubeDL(unittest.TestCase): test('a%(width|)d', 'a', outtmpl_na_placeholder='none') FORMATS = self.outtmpl_info['formats'] - sanitize = lambda x: x.replace(':', ' -').replace('"', "'") + sanitize = lambda x: x.replace(':', ' -').replace('"', "'").replace('\n', ' ') # Custom type casting - test('%(formats.:.id)l', 'id1, id2, id3') - test('%(formats.:.id)#l', ('id1\nid2\nid3', 'id1 id2 id3')) + test('%(formats.:.id)l', 'id 1, id 2, id 3') + test('%(formats.:.id)#l', ('id 1\nid 2\nid 3', 'id 1 id 2 id 3')) test('%(ext)l', 'mp4') - test('%(formats.:.id) 15l', ' id1, id2, id3') + test('%(formats.:.id) 18l', ' id 1, id 2, id 3') test('%(formats)j', (json.dumps(FORMATS), sanitize(json.dumps(FORMATS)))) + test('%(formats)#j', (json.dumps(FORMATS, indent=4), sanitize(json.dumps(FORMATS, indent=4)))) test('%(title5).3B', 'á') test('%(title5)U', 'áéí 𝐀') test('%(title5)#U', 'a\u0301e\u0301i\u0301 𝐀') @@ -778,8 +779,12 @@ class TestYoutubeDL(unittest.TestCase): test('%(title5)+#U', 'a\u0301e\u0301i\u0301 A') 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'")) + test('%(formats.0.id)#q', ('"id 1"', "'id 1'")) else: test('%(title4)q', ('\'foo "bar" test\'', "'foo 'bar' test'")) + test('%(formats.:.id)#q', "'id 1' 'id 2' 'id 3'") + test('%(formats.0.id)#q', "'id 1'") # Internal formatting test('%(timestamp-1000>%H-%M-%S)s', '11-43-20') |