mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2025-08-21 13:54:22 -07:00
[Misc] Fixes for 2.6 compatibility
This commit is contained in:
parent
b08a580906
commit
f24bc9272e
6 changed files with 38 additions and 8 deletions
|
@ -492,10 +492,12 @@ class TestJSInterpreter(unittest.TestCase):
|
|||
jsi = JSInterpreter('''
|
||||
function x() { let a=/,,[/,913,/](,)}/; "".replace(a, ""); return a; }
|
||||
''')
|
||||
attrs = set(('findall', 'finditer', 'flags', 'groupindex',
|
||||
'groups', 'match', 'pattern', 'scanner',
|
||||
'search', 'split', 'sub', 'subn'))
|
||||
self.assertTrue(set(dir(jsi.call_function('x'))) > attrs)
|
||||
attrs = set(('findall', 'finditer', 'match', 'scanner', 'search',
|
||||
'split', 'sub', 'subn'))
|
||||
if sys.version_info >= (2, 7):
|
||||
# documented for 2.6 but may not be found
|
||||
attrs.update(('flags', 'groupindex', 'groups', 'pattern'))
|
||||
self.assertSetEqual(set(dir(jsi.call_function('x'))) & attrs, attrs)
|
||||
|
||||
jsi = JSInterpreter('''
|
||||
function x() { let a=/,,[/,913,/](,)}/i; return a; }
|
||||
|
|
|
@ -1612,7 +1612,7 @@ Line 1
|
|||
self.assertEqual(traverse_obj(_TEST_DATA, lambda x, y: x == 'urls' and isinstance(y, list)),
|
||||
[_TEST_DATA['urls']],
|
||||
msg='function as query key should perform a filter based on (key, value)')
|
||||
self.assertCountEqual(traverse_obj(_TEST_DATA, lambda _, x: isinstance(x[0], compat_str)), {'str'},
|
||||
self.assertCountEqual(traverse_obj(_TEST_DATA, lambda _, x: isinstance(x[0], compat_str)), ('str',),
|
||||
msg='exceptions in the query function should be caught')
|
||||
|
||||
# Test alternative paths
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue