Merge branch 'main' into isolate-batches
This commit is contained in:
commit
074a41c6cf
10 files changed
+143
-28
No files matched your search
+42
-2
@@ -156,12 +156,52 @@ def test_a_require_gate_keeps_the_row_with_a_reason(
|
||||
scores = store.scores(agent.id)
|
||||
assert scores[berlin][1] == "" and scores[berlin][0] > 0
|
||||
assert scores[munich] == (0.0, "place not Berlin")
|
||||
assert scores[nowhere] == (0.0, "place unknown")
|
||||
# An empty column is no evidence: the role ranks, and extract can reach it.
|
||||
assert scores[nowhere][1] == "" and scores[nowhere][0] > 0
|
||||
shown = store.roles(agent=agent.id)
|
||||
assert [r.uid for r in shown] == [berlin]
|
||||
assert {r.uid for r in shown} == {berlin, nowhere}
|
||||
assert {r.uid for r in store.roles(agent=agent.id, gated=True)} == {berlin, munich, nowhere}
|
||||
|
||||
|
||||
def test_any_gates_are_one_group_a_role_must_match_one_of(
|
||||
store: Store, config: Config, fake: FakeEmbedder) -> None:
|
||||
""""In Denmark, or remote": a role passes on either, is gated when it has
|
||||
evidence against both, and ranks when both columns are empty."""
|
||||
copenhagen = role(store, "1", place="Copenhagen, Denmark")
|
||||
remote_de = role(store, "2", place="Berlin, Germany", remote="remote")
|
||||
onsite_de = role(store, "3", place="Berlin, Germany", remote="onsite")
|
||||
hybrid_nowhere = role(store, "4", place="Hybrid") # remote from place, no country
|
||||
blank = role(store, "5")
|
||||
agent = store.save_agent("Copenhagen or remote", "", [
|
||||
Gate(field="country", values=["DK"], mode="any"),
|
||||
Gate(field="remote", values=["remote"], mode="any")])
|
||||
|
||||
run(config, store, score.run_score)
|
||||
|
||||
scores = store.scores(agent.id)
|
||||
assert scores[copenhagen][1] == "" and scores[remote_de][1] == ""
|
||||
assert scores[onsite_de] == (0.0, "none of country DK, remote remote")
|
||||
assert scores[blank][1] == ""
|
||||
# "Hybrid" is a country-less line the remote lookup reads as hybrid, so
|
||||
# the group has evidence against remote and none for country: gated.
|
||||
assert scores[hybrid_nowhere][1].startswith("none of")
|
||||
|
||||
|
||||
def test_failed_gates_reads_evidence_only() -> None:
|
||||
gates = [Gate(field="country", values=["DK"]),
|
||||
Gate(field="remote", values=["remote"], mode="any"),
|
||||
Gate(field="seniority", values=["senior"], mode="any"),
|
||||
Gate(field="function", values=["engineering"], mode="prefer")]
|
||||
def cand(*states: int) -> Candidate:
|
||||
return Candidate(uid="u", first_seen=NOW.isoformat(), affinity=0, gates=list(states))
|
||||
assert score.failed_gates(cand(1, 1, 0, 0), gates) == []
|
||||
assert score.failed_gates(cand(-1, -1, -1, 0), gates) == []
|
||||
assert score.failed_gates(cand(0, 0, -1, 1), gates) == [
|
||||
"country not DK", "none of remote remote, seniority senior"]
|
||||
assert score.failed_gates(cand(1, 0, 0, 1), gates) == [
|
||||
"none of remote remote, seniority senior"]
|
||||
|
||||
|
||||
def test_a_prefer_gate_adds_its_weight_to_the_score(
|
||||
store: Store, config: Config, fake: FakeEmbedder) -> None:
|
||||
remote = role(store, "1", remote="remote")
|
||||
|
||||
Reference in new issue
Block a user