test: harden blocked-task regression tests per review

This commit is contained in:
Abhimanyu Saharan
2026-03-04 23:01:24 +05:30
parent 130947dcea
commit 636c130a3b
2 changed files with 30 additions and 8 deletions

View File

@@ -18,12 +18,17 @@ def test_openapi_blocked_task_error_includes_code_field() -> None:
code_schema = props["code"]
any_of = code_schema.get("anyOf")
assert isinstance(any_of, list) and any_of
if any_of:
assert isinstance(any_of, list)
has_string_branch = any(branch.get("type") == "string" for branch in any_of)
assert has_string_branch
has_string_branch = any(branch.get("type") == "string" for branch in any_of)
assert has_string_branch
has_null_branch = any(
branch.get("type") == "null" or branch.get("nullable") is True for branch in any_of
)
assert has_null_branch
has_null_branch = any(
branch.get("type") == "null" or branch.get("nullable") is True for branch in any_of
)
assert has_null_branch
else:
# Alternative encoding used by some schema versions for Optional[str].
assert code_schema.get("type") == "string"
assert code_schema.get("nullable") is True