From e1e9ffa8ec1f2e626b7e301e6b50f2b2b070948c Mon Sep 17 00:00:00 2001 From: Kazgatari <56477241+Kazgatari@users.noreply.github.com> Date: Tue, 14 Jul 2026 23:19:05 +0200 Subject: [PATCH] added queries for patents and projects --- .../test_trend_strategies.py | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 service/src/main/inse/university_ranking/test_trend_strategies.py diff --git a/service/src/main/inse/university_ranking/test_trend_strategies.py b/service/src/main/inse/university_ranking/test_trend_strategies.py new file mode 100644 index 00000000..936c17b4 --- /dev/null +++ b/service/src/main/inse/university_ranking/test_trend_strategies.py @@ -0,0 +1,30 @@ +import pytest +from inse.university_ranking.trend_strategies import PatentsTrendStrategy, ProjectsTrendStrategy + +@pytest.mark.anyio +async def test_patents_trend_strategy(): + strategy = PatentsTrendStrategy() + res = await strategy.get_trend( + topics=["Biotechnology and Related Fields"], + fuzzy=True, + institutions=["https://openalex.org/I62318514"] + ) + assert res is not None + assert len(res.series) > 0 + series_ude = [s for s in res.series if s.entity_id == "https://openalex.org/I62318514"] + assert len(series_ude) == 1 + assert "Biotechnology and Related Fields" in series_ude[0].topic_data + +@pytest.mark.anyio +async def test_projects_trend_strategy(): + strategy = ProjectsTrendStrategy() + res = await strategy.get_trend( + topics=["Biotechnology and Related Fields"], + fuzzy=True, + institutions=["https://openalex.org/I62318514"] + ) + assert res is not None + assert len(res.series) > 0 + series_ude = [s for s in res.series if s.entity_id == "https://openalex.org/I62318514"] + assert len(series_ude) == 1 + assert "Biotechnology and Related Fields" in series_ude[0].topic_data