researchbee / tests /test_subject_quartiles.py
nikeshn's picture
Upload 11 files
3685d4c verified
Raw History Blame Contribute Delete
1.36 kB
from __future__ import annotations
import app
def test_subject_result_includes_all_field_quartiles(monkeypatch):
monkeypatch.setattr(app, "lookup_any", lambda _issns: {
"matched_issn": "1234-5678",
"quartile": "Q1",
"h_index": "88",
"publisher": "Example Publisher",
"open_access": "Yes",
"country": "UAE",
"categories": "Engineering (Q1); Energy (Q2)",
"sourceid": "999",
"quartiles_by_field": [
{"code": "2201", "field": "Engineering", "quartile": "Q1"},
{"code": "2102", "field": "Energy", "quartile": "Q2"},
],
"state": "indexed_ranked",
"currently_indexed": True,
"warn": False,
})
monkeypatch.setattr(app, "build_verify_links", lambda *_args: {"scimago": "https://example.test"})
monkeypatch.setattr(app, "is_ku_apc_covered", lambda *_args: False)
result = app.build_subject_journal_result({
"title": "Example Journal",
"issn": "1234-5678",
"quartile": "Q1",
"h_index": 80,
})
assert result["quartile"] == "Q1"
assert result["quartiles_by_field"] == [
{"code": "2201", "field": "Engineering", "quartile": "Q1"},
{"code": "2102", "field": "Energy", "quartile": "Q2"},
]
assert result["h_index"] == 88