Bahn: aisupport, Analyse-O2C-C2S, awesome-bahn-mcp-servers, beam-mcp,
Confluence_Bot, db-planet-mcp-server, O2C-Harness, project-audit,
Projekt-KIQ-HP, teamlandkarte-mcp
Dhive: Jury-Voting
Privat: CV, NoteGraph (NOTE: NoteGraph needs complete redo after consolidation)
Shared: AI-Orchestrator, OrgMyLife, power_skills_and_more
Shared/references: symphony (read-only)
Bahn repos remain available as independent remotes - this monorepo
pulls them in via subtree, the originals are untouched.
114 lines
3.6 KiB
Python
114 lines
3.6 KiB
Python
from __future__ import annotations
|
|
|
|
from teamlandkarte_mcp.config import MatchingConfig, MatchingThresholds
|
|
from teamlandkarte_mcp.matching.scorer import categorize, compute_overall
|
|
|
|
|
|
def test_compute_overall_round6_weights() -> None:
|
|
cfg = MatchingConfig(
|
|
competence_weight=0.8,
|
|
role_weight=0.2,
|
|
thresholds=MatchingThresholds(top=0.8, good=0.6, partial=0.4),
|
|
)
|
|
|
|
b = compute_overall(competence_score=1.0, role_score=0.0, cfg=cfg)
|
|
assert b.overall_score == 0.8
|
|
assert b.category == "Top"
|
|
|
|
b = compute_overall(competence_score=0.0, role_score=1.0, cfg=cfg)
|
|
assert b.overall_score == 0.2
|
|
assert b.category == "Low"
|
|
|
|
|
|
def test_categorize_threshold_boundaries() -> None:
|
|
"""Test categorization with recommended thresholds (Feb 2026)."""
|
|
cfg = MatchingConfig(
|
|
competence_weight=0.8,
|
|
role_weight=0.2,
|
|
thresholds=MatchingThresholds(
|
|
top=0.8,
|
|
good=0.65,
|
|
partial=0.5,
|
|
low=0.3,
|
|
),
|
|
)
|
|
|
|
# Top boundary
|
|
assert categorize(0.8, cfg) == "Top"
|
|
assert categorize(0.79, cfg) == "Good"
|
|
|
|
# Good boundary
|
|
assert categorize(0.65, cfg) == "Good"
|
|
assert categorize(0.64, cfg) == "Partial"
|
|
|
|
# Partial boundary
|
|
assert categorize(0.5, cfg) == "Partial"
|
|
assert categorize(0.49, cfg) == "Low"
|
|
|
|
# Low boundary
|
|
assert categorize(0.3, cfg) == "Low"
|
|
assert categorize(0.29, cfg) == "Irrelevant"
|
|
|
|
|
|
def test_categorize_with_low_threshold_config() -> None:
|
|
"""Test categorization with low=0.2 threshold (user's actual config)."""
|
|
cfg = MatchingConfig(
|
|
competence_weight=1.0,
|
|
role_weight=0.0,
|
|
thresholds=MatchingThresholds(
|
|
top=0.8,
|
|
good=0.6,
|
|
partial=0.4,
|
|
low=0.2, # User's actual config
|
|
),
|
|
)
|
|
|
|
# Exact boundaries
|
|
assert categorize(0.8, cfg) == "Top"
|
|
assert categorize(0.6, cfg) == "Good"
|
|
assert categorize(0.4, cfg) == "Partial" # ← Should be Partial!
|
|
assert categorize(0.2, cfg) == "Low"
|
|
assert categorize(0.19, cfg) == "Irrelevant"
|
|
|
|
# Scores slightly above 0.4 should be Partial
|
|
assert categorize(0.41, cfg) == "Partial"
|
|
assert categorize(0.42, cfg) == "Partial"
|
|
assert categorize(0.45, cfg) == "Partial"
|
|
assert categorize(0.5, cfg) == "Partial"
|
|
|
|
# Scores between 0.2 and 0.4 should be Low
|
|
assert categorize(0.21, cfg) == "Low"
|
|
assert categorize(0.3, cfg) == "Low"
|
|
assert categorize(0.39, cfg) == "Low"
|
|
|
|
# Scores below 0.2 should be Irrelevant
|
|
assert categorize(0.15, cfg) == "Irrelevant"
|
|
assert categorize(0.1, cfg) == "Irrelevant"
|
|
|
|
|
|
def test_compute_overall_with_user_config() -> None:
|
|
"""Test overall score computation with user's actual config (competence_weight=1.0)."""
|
|
cfg = MatchingConfig(
|
|
competence_weight=1.0,
|
|
role_weight=0.0,
|
|
thresholds=MatchingThresholds(
|
|
top=0.8,
|
|
good=0.6,
|
|
partial=0.4,
|
|
low=0.2,
|
|
),
|
|
)
|
|
|
|
# When role_weight=0, overall score should equal competence score
|
|
b = compute_overall(competence_score=0.45, role_score=0.0, cfg=cfg)
|
|
assert b.overall_score == 0.45
|
|
assert b.category == "Partial", f"Score 0.45 should be Partial, got {b.category}"
|
|
|
|
b = compute_overall(competence_score=0.4, role_score=0.0, cfg=cfg)
|
|
assert b.overall_score == 0.4
|
|
assert b.category == "Partial", f"Score 0.4 should be Partial, got {b.category}"
|
|
|
|
b = compute_overall(competence_score=0.39, role_score=0.5, cfg=cfg)
|
|
assert b.overall_score == 0.39 # role is ignored (weight=0)
|
|
assert b.category == "Low", f"Score 0.39 should be Low, got {b.category}"
|