84e6191fc2
Co-authored-by: Cursor <cursoragent@cursor.com>
65 lines
2.0 KiB
Python
65 lines
2.0 KiB
Python
from __future__ import annotations
|
|
|
|
from scripts.rectification.horary_observation import build_horary_observation
|
|
|
|
|
|
def _request(**overrides):
|
|
body = {
|
|
"birth_date": "1993-04-17",
|
|
"start_time": "14:29",
|
|
"end_time": "14:30",
|
|
"lat": 36.683333,
|
|
"lon": 114.35,
|
|
"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
|