about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
authordirkf <fieldhouse@gmx.net>2023-07-04 16:06:21 +0100
committerdirkf <fieldhouse@gmx.net>2023-07-05 22:58:54 +0100
commitf24bc9272e9b74efc4c4af87c862f5f78921d424 (patch)
tree6454f8c8ab758b3e18f6d39395b91da822069819 /test
parentb08a58090635777f1001d5cde2cd141a5565177c (diff)
downloadyoutube-dl-f24bc9272e9b74efc4c4af87c862f5f78921d424.tar.gz
youtube-dl-f24bc9272e9b74efc4c4af87c862f5f78921d424.tar.xz
youtube-dl-f24bc9272e9b74efc4c4af87c862f5f78921d424.zip
[Misc] Fixes for 2.6 compatibility
Diffstat (limited to 'test')
-rw-r--r--test/test_jsinterp.py10
-rw-r--r--test/test_utils.py2
2 files changed, 7 insertions, 5 deletions
diff --git a/test/test_jsinterp.py b/test/test_jsinterp.py
index ecd6ab3c9..91b12f544 100644
--- a/test/test_jsinterp.py
+++ b/test/test_jsinterp.py
@@ -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; }
diff --git a/test/test_utils.py b/test/test_utils.py
index b85d397d0..5fab05f7c 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -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