small changes to test and Artifact removal

This commit is contained in:
Kazgatari
2026-06-29 14:13:58 +02:00
parent 84b3ec4148
commit e206f40822
3 changed files with 30 additions and 32 deletions
+1
View File
@@ -6,6 +6,7 @@
import logging
from typing import Any
from pydantic import ValidationError
from ..persons import logic as person_logic
from . import model
from .elastic_search_client import FundedPublicationsSearchClient
+2 -4
View File
@@ -1,6 +1,6 @@
import pytest
from unittest.mock import AsyncMock, patch
from fastapi import HTTPException
from inse.exceptions import MissingApiKeyError
from inse.funders import logic
from inse.funders.elastic_search_client import FundedPublicationsSearchClient
@@ -340,7 +340,5 @@ async def test_get_funders_by_author_id_maps_missing_api_key_to_service_unavaila
client = FundedPublicationsSearchClient(api_key="")
with pytest.raises(HTTPException) as exc:
with pytest.raises(MissingApiKeyError):
await logic.get_funders_by_author_id("A5023888391", client=client)
assert exc.value.status_code == 503
+27 -28
View File
@@ -272,36 +272,35 @@ async def get_all_patents(
all_patents_client = AllPatentsSearchClient()
ipc_search_client = ipc_client or IpcSearchClient()
try:
if source == "EPO":
epo_data = await all_patents_client.search_epo(
all_patents_client.epo_query(page, size, search, sort_direction)
)
patents = _parse_epo_hits(epo_data)
total = epo_data.get("hits", {}).get("total", {}).get("value", 0)
if source == "EPO":
epo_data = await all_patents_client.search_epo(
all_patents_client.epo_query(page, size, search, sort_direction)
)
patents = _parse_epo_hits(epo_data)
total = epo_data.get("hits", {}).get("total", {}).get("value", 0)
elif source == "USPTO":
uspto_data = await all_patents_client.search_uspto(
all_patents_client.uspto_query(page, size, search, sort_direction)
)
patents = _parse_uspto_hits(uspto_data)
total = uspto_data.get("hits", {}).get("total", {}).get("value", 0)
elif source == "USPTO":
uspto_data = await all_patents_client.search_uspto(
all_patents_client.uspto_query(page, size, search, sort_direction)
)
patents = _parse_uspto_hits(uspto_data)
total = uspto_data.get("hits", {}).get("total", {}).get("value", 0)
else:
half = size // 2
epo_data, uspto_data = await asyncio.gather(
all_patents_client.search_epo(
all_patents_client.epo_query(page, half, search, sort_direction)
),
all_patents_client.search_uspto(
all_patents_client.uspto_query(page, half, search, sort_direction)
),
)
patents = _parse_epo_hits(epo_data) + _parse_uspto_hits(uspto_data)
total = (
epo_data.get("hits", {}).get("total", {}).get("value", 0) +
uspto_data.get("hits", {}).get("total", {}).get("value", 0)
)
else:
half = size // 2
epo_data, uspto_data = await asyncio.gather(
all_patents_client.search_epo(
all_patents_client.epo_query(page, half, search, sort_direction)
),
all_patents_client.search_uspto(
all_patents_client.uspto_query(page, half, search, sort_direction)
),
)
patents = _parse_epo_hits(epo_data) + _parse_uspto_hits(uspto_data)
total = (
epo_data.get("hits", {}).get("total", {}).get("value", 0) +
uspto_data.get("hits", {}).get("total", {}).get("value", 0)
)
await _enrich_patents_classifications(patents, ipc_search_client)