|
|
@ -38,6 +38,7 @@ from youtube_dl.utils import (
|
|
|
|
parse_iso8601,
|
|
|
|
parse_iso8601,
|
|
|
|
read_batch_urls,
|
|
|
|
read_batch_urls,
|
|
|
|
sanitize_filename,
|
|
|
|
sanitize_filename,
|
|
|
|
|
|
|
|
sanitize_path,
|
|
|
|
shell_quote,
|
|
|
|
shell_quote,
|
|
|
|
smuggle_url,
|
|
|
|
smuggle_url,
|
|
|
|
str_to_int,
|
|
|
|
str_to_int,
|
|
|
@ -131,6 +132,26 @@ class TestUtil(unittest.TestCase):
|
|
|
|
self.assertEqual(sanitize_filename('_BD_eEpuzXw', is_id=True), '_BD_eEpuzXw')
|
|
|
|
self.assertEqual(sanitize_filename('_BD_eEpuzXw', is_id=True), '_BD_eEpuzXw')
|
|
|
|
self.assertEqual(sanitize_filename('N0Y__7-UOdI', is_id=True), 'N0Y__7-UOdI')
|
|
|
|
self.assertEqual(sanitize_filename('N0Y__7-UOdI', is_id=True), 'N0Y__7-UOdI')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_sanitize_path(self):
|
|
|
|
|
|
|
|
if sys.platform != 'win32':
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.assertEqual(sanitize_path('abc'), 'abc')
|
|
|
|
|
|
|
|
self.assertEqual(sanitize_path('abc/def'), 'abc\\def')
|
|
|
|
|
|
|
|
self.assertEqual(sanitize_path('abc\\def'), 'abc\\def')
|
|
|
|
|
|
|
|
self.assertEqual(sanitize_path('abc|def'), 'abc#def')
|
|
|
|
|
|
|
|
self.assertEqual(sanitize_path('<>:"|?*'), '#######')
|
|
|
|
|
|
|
|
self.assertEqual(sanitize_path('C:/abc/def'), 'C:\\abc\\def')
|
|
|
|
|
|
|
|
self.assertEqual(sanitize_path('C?:/abc/def'), 'C##\\abc\\def')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.assertEqual(sanitize_path('\\\\?\\UNC\\ComputerName\\abc'), '\\\\?\\UNC\\ComputerName\\abc')
|
|
|
|
|
|
|
|
self.assertEqual(sanitize_path('\\\\?\\UNC/ComputerName/abc'), '\\\\?\\UNC\\ComputerName\\abc')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.assertEqual(sanitize_path('\\\\?\\C:\\abc'), '\\\\?\\C:\\abc')
|
|
|
|
|
|
|
|
self.assertEqual(sanitize_path('\\\\?\\C:/abc'), '\\\\?\\C:\\abc')
|
|
|
|
|
|
|
|
self.assertEqual(sanitize_path('\\\\?\\C:\\ab?c\\de:f'), '\\\\?\\C:\\ab#c\\de#f')
|
|
|
|
|
|
|
|
self.assertEqual(sanitize_path('\\\\?\\C:\\abc'), '\\\\?\\C:\\abc')
|
|
|
|
|
|
|
|
|
|
|
|
def test_ordered_set(self):
|
|
|
|
def test_ordered_set(self):
|
|
|
|
self.assertEqual(orderedSet([1, 1, 2, 3, 4, 4, 5, 6, 7, 3, 5]), [1, 2, 3, 4, 5, 6, 7])
|
|
|
|
self.assertEqual(orderedSet([1, 1, 2, 3, 4, 4, 5, 6, 7, 3, 5]), [1, 2, 3, 4, 5, 6, 7])
|
|
|
|
self.assertEqual(orderedSet([]), [])
|
|
|
|
self.assertEqual(orderedSet([]), [])
|
|
|
|