Files
PlantAI-dev/tests/unit/test_intent_species_roles.py
T

33 lines
1.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from gfa_core.mas.utils.intent_parser import (
parse_explicit_species_role_mentions,
parse_gene_family_scope_selection,
)
def test_ref_data_path_does_not_assign_species_roles() -> None:
query = (
"苦荞基因组数据在 "
"/home/xia-lab/wutx_old/wutx/plantAnalysisAgent/ref_data/Tartary_genome,"
"拟南芥基因组数据在 "
"/home/xia-lab/wutx_old/wutx/plantAnalysisAgent/ref_data/ath,"
"Ft是目标物种,At是参考物种"
)
scope = parse_gene_family_scope_selection(query)
assert scope["targetSpecies"] == ["Ft"]
assert scope["referenceSpecies"] == ["At"]
def test_explicit_role_parser_keeps_unassigned_mentions_separate() -> None:
roles = parse_explicit_species_role_mentions(
"Os和At的数据已经准备好;Os是目标物种,At是参考物种,Ppy稍后再分析"
)
assert roles == {
"targetSpecies": ["Os"],
"referenceSpecies": ["At"],
"comparativeSpecies": [],
"unassigned": ["Ppy"],
}