aboutsummaryrefslogtreecommitdiff
path: root/test/helper.py
diff options
context:
space:
mode:
authorsepro <4618135+seproDev@users.noreply.github.com>2023-11-26 03:12:05 +0100
committerGitHub <noreply@github.com>2023-11-26 02:12:05 +0000
commit1732eccc0a40256e076bf0435a29f0f1d8419280 (patch)
tree744fa8377e8c7a9ba85b7ec70b6cc26ed5bc867e /test/helper.py
parenta0b19d319a6ce8b7059318fa17a34b144fde1785 (diff)
[core] Parse `release_year` from `release_date` (#8524)
Closes #7263 Authored by: seproDev
Diffstat (limited to 'test/helper.py')
-rw-r--r--test/helper.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/helper.py b/test/helper.py
index 7503840be..e5ace8fe2 100644
--- a/test/helper.py
+++ b/test/helper.py
@@ -10,7 +10,7 @@ import types
import yt_dlp.extractor
from yt_dlp import YoutubeDL
from yt_dlp.compat import compat_os_name
-from yt_dlp.utils import preferredencoding, write_string
+from yt_dlp.utils import preferredencoding, try_call, write_string
if 'pytest' in sys.modules:
import pytest
@@ -223,6 +223,10 @@ def sanitize_got_info_dict(got_dict):
if test_info_dict.get('display_id') == test_info_dict.get('id'):
test_info_dict.pop('display_id')
+ # release_year may be generated from release_date
+ if try_call(lambda: test_info_dict['release_year'] == int(test_info_dict['release_date'][:4])):
+ test_info_dict.pop('release_year')
+
# Check url for flat entries
if got_dict.get('_type', 'video') != 'video' and got_dict.get('url'):
test_info_dict['url'] = got_dict['url']