[utils] subs_list_to_dict: Fix empty value handling (#17311)

Authored by: doe1080
This commit is contained in:
doe1080
2026-08-29 23:55:22 +02:00
committed by GitHub
parent 8377aa9555
commit fcdbefb85f
2 changed files with 14 additions and 2 deletions
+12
View File
@@ -546,6 +546,18 @@ class TestTraversalHelpers:
{'url': 'https://example.com/subs/de4'},
],
}, 'non str types should be replaced by default id'
assert traverse_obj([
{'name': '', 'ext': '', 'url': 'https://example.com/subs/en'},
], [..., {
'id': 'name',
'ext': 'ext',
'url': 'url',
}, all, {subs_list_to_dict(lang='en', ext='vtt')}]) == {
'en': [{
'ext': 'vtt',
'url': 'https://example.com/subs/en',
}],
}, 'empty id and ext should be replaced by defaults'
def test_trim_str(self):
with pytest.raises(TypeError):