mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-04 23:17:20 +08:00
refactor: unify tmdb query contracts
This commit is contained in:
@@ -397,6 +397,37 @@ def test_sync_and_async_anilist_capabilities_share_contracts() -> None:
|
||||
assert contract.aggregation is expected
|
||||
|
||||
|
||||
def test_sync_and_async_tmdb_capabilities_share_contracts() -> None:
|
||||
"""TMDB 同步与异步查询应共享列表或首值契约。"""
|
||||
list_methods = {
|
||||
"tmdb_collection",
|
||||
"tmdb_discover",
|
||||
"tmdb_episodes",
|
||||
"tmdb_group_seasons",
|
||||
"tmdb_movie_credits",
|
||||
"tmdb_movie_recommend",
|
||||
"tmdb_movie_similar",
|
||||
"tmdb_person_credits",
|
||||
"tmdb_seasons",
|
||||
"tmdb_trending",
|
||||
"tmdb_tv_credits",
|
||||
"tmdb_tv_recommend",
|
||||
"tmdb_tv_similar",
|
||||
}
|
||||
value_methods = {"tmdb_info", "tmdb_person_detail"}
|
||||
|
||||
for sync_method in list_methods | value_methods:
|
||||
contract = get_module_method_contract(sync_method)
|
||||
assert contract is get_module_method_contract(f"async_{sync_method}")
|
||||
expected = (
|
||||
ModuleResultAggregation.ORDERED_LIST_MERGE
|
||||
if sync_method in list_methods
|
||||
else ModuleResultAggregation.FIRST_NON_EMPTY
|
||||
)
|
||||
assert contract.aggregation is expected
|
||||
assert contract.required_parameters
|
||||
|
||||
|
||||
def test_attachment_result_diagnostics_distinguish_bytes_and_strings() -> None:
|
||||
"""附件契约应区分二进制内容和可展示字符串,偏差仍仅供诊断。"""
|
||||
assert diagnose_module_result("download_qq_file_bytes", b"content") == ()
|
||||
|
||||
Reference in New Issue
Block a user