aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-08-04 23:47:55 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-08-05 00:07:05 +0530
commit97d9c79e926197dcf277635d2582f882df4290ac (patch)
tree2acc6084da77d389bb583218603f66e2064a5495
parentf62f553d46856aff2e36a0d561ec78a1d28d5b68 (diff)
downloadhypervideo-pre-97d9c79e926197dcf277635d2582f882df4290ac.tar.lz
hypervideo-pre-97d9c79e926197dcf277635d2582f882df4290ac.tar.xz
hypervideo-pre-97d9c79e926197dcf277635d2582f882df4290ac.zip
Fix tests for 989a01c2610832193c268d072ada8814bfd4c00d
-rw-r--r--test/test_YoutubeDL.py18
-rw-r--r--test/test_utils.py10
2 files changed, 14 insertions, 14 deletions
diff --git a/test/test_YoutubeDL.py b/test/test_YoutubeDL.py
index 3e6f7ec3f..49dc2c198 100644
--- a/test/test_YoutubeDL.py
+++ b/test/test_YoutubeDL.py
@@ -722,7 +722,7 @@ class TestYoutubeDL(unittest.TestCase):
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', '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
@@ -770,7 +770,7 @@ class TestYoutubeDL(unittest.TestCase):
test('a%(width|)d', 'a', outtmpl_na_placeholder='none')
FORMATS = self.outtmpl_info['formats']
- sanitize = lambda x: x.replace(':', ' -').replace('"', "'").replace('\n', ' ')
+ sanitize = lambda x: x.replace(':', ':').replace('"', """).replace('\n', ' ')
# Custom type casting
test('%(formats.:.id)l', 'id 1, id 2, id 3')
@@ -788,13 +788,13 @@ class TestYoutubeDL(unittest.TestCase):
test('%(filesize)#D', '1Ki')
test('%(height)5.2D', ' 1.08k')
test('%(title4)#S', 'foo_bar_test')
- test('%(title4).10S', ('foo \'bar\' ', 'foo \'bar\'' + ('#' if compat_os_name == 'nt' else ' ')))
+ test('%(title4).10S', ('foo "bar" ', 'foo "bar"' + ('#' if compat_os_name == 'nt' else ' ')))
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'"))
+ 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('%(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'")
@@ -852,8 +852,8 @@ class TestYoutubeDL(unittest.TestCase):
# Path expansion and escaping
test('Hello %(title1)s', 'Hello $PATH')
test('Hello %(title2)s', 'Hello %PATH%')
- test('%(title3)s', ('foo/bar\\test', 'foo_bar_test'))
- test('folder/%(title3)s', ('folder/foo/bar\\test', 'folder%sfoo_bar_test' % os.path.sep))
+ test('%(title3)s', ('foo/bar\\test', 'foo⧸bar⧹test'))
+ test('folder/%(title3)s', ('folder/foo/bar\\test', 'folder%sfoo⧸bar⧹test' % os.path.sep))
def test_format_note(self):
ydl = YoutubeDL()
diff --git a/test/test_utils.py b/test/test_utils.py
index 989a99ea3..659b071d3 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -140,13 +140,13 @@ class TestUtil(unittest.TestCase):
self.assertEqual(sanitize_filename('123'), '123')
- self.assertEqual('abc_de', sanitize_filename('abc/de'))
+ self.assertEqual('abc⧸de', sanitize_filename('abc/de'))
self.assertFalse('/' in sanitize_filename('abc/de///'))
- self.assertEqual('abc_de', sanitize_filename('abc/<>\\*|de'))
- self.assertEqual('xxx', sanitize_filename('xxx/<>\\*|'))
- self.assertEqual('yes no', sanitize_filename('yes? no'))
- self.assertEqual('this - that', sanitize_filename('this: that'))
+ self.assertEqual('abc_de', sanitize_filename('abc/<>\\*|de', is_id=False))
+ self.assertEqual('xxx', sanitize_filename('xxx/<>\\*|', is_id=False))
+ self.assertEqual('yes no', sanitize_filename('yes? no', is_id=False))
+ self.assertEqual('this - that', sanitize_filename('this: that', is_id=False))
self.assertEqual(sanitize_filename('AT&T'), 'AT&T')
aumlaut = 'ä'