aboutsummaryrefslogtreecommitdiffstats
path: root/test/helper.py
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2022-02-05 10:48:13 -0500
committerJesús <heckyel@hyperbola.info>2022-02-05 10:48:13 -0500
commitc4b763b19f54ed5dfc2fd408adb9ed74126f6740 (patch)
tree1bbf4450644370608f97bf6d4d7db818c5039f55 /test/helper.py
parent5aac4e0267e32d98eb68692afedafda3b41ea629 (diff)
parenta3125791c7a5cdf2c8c025b99788bf686edd1a8a (diff)
downloadhypervideo-pre-c4b763b19f54ed5dfc2fd408adb9ed74126f6740.tar.lz
hypervideo-pre-c4b763b19f54ed5dfc2fd408adb9ed74126f6740.tar.xz
hypervideo-pre-c4b763b19f54ed5dfc2fd408adb9ed74126f6740.zip
updated from upstream | 05/02/2022 at 10:48
Diffstat (limited to 'test/helper.py')
-rw-r--r--test/helper.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/helper.py b/test/helper.py
index b63a5c897..1070e0668 100644
--- a/test/helper.py
+++ b/test/helper.py
@@ -211,7 +211,7 @@ def sanitize_got_info_dict(got_dict):
# Auto-generated
'autonumber', 'playlist', 'format_index', 'video_ext', 'audio_ext', 'duration_string', 'epoch',
- 'fulltitle', 'extractor', 'extractor_key', 'filepath', 'infojson_filename', 'original_url',
+ 'fulltitle', 'extractor', 'extractor_key', 'filepath', 'infojson_filename', 'original_url', 'n_entries',
# Only live_status needs to be checked
'is_live', 'was_live',
@@ -220,10 +220,12 @@ def sanitize_got_info_dict(got_dict):
IGNORED_PREFIXES = ('', 'playlist', 'requested', 'webpage')
def sanitize(key, value):
- if isinstance(value, str) and len(value) > 100:
+ if isinstance(value, str) and len(value) > 100 and key != 'thumbnail':
return f'md5:{md5(value)}'
elif isinstance(value, list) and len(value) > 10:
return f'count:{len(value)}'
+ elif key.endswith('_count') and isinstance(value, int):
+ return int
return value
test_info_dict = {
@@ -233,7 +235,7 @@ def sanitize_got_info_dict(got_dict):
}
# display_id may be generated from id
- if test_info_dict.get('display_id') == test_info_dict['id']:
+ if test_info_dict.get('display_id') == test_info_dict.get('id'):
test_info_dict.pop('display_id')
return test_info_dict
@@ -259,6 +261,8 @@ def expect_info_dict(self, got_dict, expected_dict):
def _repr(v):
if isinstance(v, compat_str):
return "'%s'" % v.replace('\\', '\\\\').replace("'", "\\'").replace('\n', '\\n')
+ elif isinstance(v, type):
+ return v.__name__
else:
return repr(v)
info_dict_str = ''