Prepare branch for remote review; preserve documented validation gaps and protected historical packages. Co-Authored-By: Claude Code <noreply@anthropic.com>
67 lines
2.1 KiB
Python
67 lines
2.1 KiB
Python
from __future__ import annotations
|
|
|
|
from tests.conftest import FIXTURE_BIRTH_DATE, FIXTURE_BIRTH_LAT, FIXTURE_BIRTH_LON
|
|
|
|
from scripts.rectification.horary_observation import build_horary_observation
|
|
|
|
|
|
def _request(**overrides):
|
|
body = {
|
|
"birth_date": FIXTURE_BIRTH_DATE,
|
|
"start_time": "14:29",
|
|
"end_time": "14:30",
|
|
"lat": FIXTURE_BIRTH_LAT,
|
|
"lon": FIXTURE_BIRTH_LON,
|
|
"tz": 8.0,
|
|
"events": [],
|
|
}
|
|
body.update(overrides)
|
|
return body
|
|
|
|
|
|
def test_horary_without_query_is_skipped() -> None:
|
|
result = build_horary_observation(_request(events=[{
|
|
"id": "00000000-0000-4000-8000-000000000001",
|
|
"domain": "career",
|
|
"event_kind": "career_entry",
|
|
"date_start": "2019-07-01",
|
|
"date_end": "2019-07-01",
|
|
"precision": "day",
|
|
}]))
|
|
assert result["status"] == "skipped"
|
|
assert result["unique_minute_claim"] is False
|
|
|
|
|
|
def test_dated_horary_query_is_observation_only() -> None:
|
|
result = build_horary_observation(_request(events=[{
|
|
"id": "00000000-0000-4000-8000-000000000002",
|
|
"domain": "horary",
|
|
"event_kind": "horary_query",
|
|
"date_start": "2024-01-15",
|
|
"date_end": "2024-01-15",
|
|
"precision": "day",
|
|
"summary": "第一次问起是 14:30",
|
|
}]))
|
|
assert result["status"] in {"executed", "blocked"}
|
|
assert result["unique_minute_claim"] is False
|
|
assert "不计分" in result["user_meaning"]
|
|
if result["status"] == "executed":
|
|
assert result["question_date"] == "2024-01-15"
|
|
assert result["question_time"] == "14:30"
|
|
assert result.get("lagna")
|
|
|
|
|
|
def test_horary_without_coordinates_is_blocked_not_a_gate_fail() -> None:
|
|
result = build_horary_observation({
|
|
"events": [{
|
|
"id": "00000000-0000-4000-8000-000000000003",
|
|
"domain": "horary",
|
|
"event_kind": "horary_query",
|
|
"date_start": "2024-01-15",
|
|
"date_end": "2024-01-15",
|
|
"precision": "day",
|
|
}],
|
|
})
|
|
assert result["status"] == "blocked"
|
|
assert result["unique_minute_claim"] is False
|