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