1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-08-14 00:18:31 +00:00

Update tests for better windows lookalike chars

This commit is contained in:
Zezombye 2025-08-12 06:59:35 +02:00 committed by GitHub
parent 3665d8823d
commit d000c72737
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -802,7 +802,7 @@ def test(tmpl, expected, *, info=None, **params):
test('%(id)s', '-abcd', info={'id': '-abcd'})
test('%(id)s', '.abcd', info={'id': '.abcd'})
test('%(id)s', 'ab__cd', info={'id': 'ab__cd'})
test('%(id)s', ('ab:cd', 'abcd'), info={'id': 'ab:cd'})
test('%(id)s', ('ab:cd', 'ab։cd'), info={'id': 'ab:cd'})
test('%(id.0)s', '-', info={'id': '--'})
# Invalid templates
@ -861,7 +861,7 @@ def expect_same_infodict(out):
test('%(formats)j', (json.dumps(FORMATS), None))
test('%(formats)#j', (
json.dumps(FORMATS, indent=4),
json.dumps(FORMATS, indent=4).replace(':', '').replace('"', '').replace('\n', ' '),
json.dumps(FORMATS, indent=4).replace(':', '։').replace('"', '').replace('\n', ' '),
))
test('%(title5).3B', 'á')
test('%(title5)U', 'áéí 𝐀')
@ -872,13 +872,13 @@ def expect_same_infodict(out):
test('%(filesize)#D', '1Ki')
test('%(height)5.2D', ' 1.08k')
test('%(title4)#S', 'foo_bar_test')
test('%(title4).10S', ('foo bar ', 'foo bar' + ('#' if os.name == 'nt' else ' ')))
test('%(title4).10S', ('foo ″bar″ ', 'foo ″bar″' + ('#' if os.name == 'nt' else ' ')))
if os.name == 'nt':
test('%(title4)q', ('"foo ""bar"" test"', None))
test('%(formats.:.id)#q', ('"id 1" "id 2" "id 3"', None))
test('%(formats.0.id)#q', ('"id 1"', None))
else:
test('%(title4)q', ('\'foo "bar" test\'', '\'foo bar test\''))
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'")
@ -903,7 +903,7 @@ def expect_same_infodict(out):
for f in FORMATS])
test('%(formats.:.{id,height.:2})j', (out, None))
test('%(formats.:.{id,height}.id)l', ', '.join(f['id'] for f in FORMATS))
test('%(.{id,title})j', ('{"id": "1234"}', '{id 1234}'))
test('%(.{id,title})j', ('{"id": "1234"}', '{″id″։ ″1234″}'))
# Alternates
test('%(title,id)s', '1234')