BUG-2179: the plan-timing clarify reply (~70 chars) went through the smalltalk free completion, which the database caps at 20 chars, so every save failed; it now settles through the feedback free completion (400 chars, still free). BUG-2180: hospital/ID records saved as 「记录下来的」 store birth_time_uncertainty_known=false (no range given); birthTimeUncertain no longer reads that as 「说不准」. BUG-2181: exact-day dates left in the eight body sections are shortened to the month; data-chapter labels drop 「来源」; children-related yoga effects use the 「传统上与…有关」 form (topic map regenerated, topics unchanged). BUG-2182: an explicit length request from the user overrides the default answer shape in chat and in-report questions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
68 lines
2.9 KiB
Python
68 lines
2.9 KiB
Python
"""BUG-2125: the report names where the birth coordinates came from, in both editions.
|
|
|
|
Without a typed pair the coordinates are the chosen place's centre (区县中心点); with one they are
|
|
the pair the person entered (你填写的经纬度). The frontend sends `coordinate_source`
|
|
"district_centroid" / "user_entered" (it sent "user_reported" for everyone before). The public
|
|
fixtures carry no flag of their own, so each case sets the flag the way the frontend does.
|
|
"""
|
|
|
|
from copy import deepcopy
|
|
|
|
import pytest
|
|
|
|
from scripts.pl9_reader_export import _pl9_export_markdown_for_edition
|
|
from tests.public_chart_reports import PUBLIC_REPORT_CASES, public_chart_reports
|
|
|
|
PROVENANCE = {
|
|
"district_centroid": "city_centroid",
|
|
"user_entered": "unverified_user_coordinates",
|
|
}
|
|
ZH = {
|
|
"district_centroid": ("| 坐标 | 区县中心点 |", "- 坐标取自:区县中心点", "- 坐标精度:按区县中心点,未精确到出生地址"),
|
|
"user_entered": ("| 坐标 | 你填写的经纬度 |", "- 坐标取自:你填写的经纬度", "- 坐标精度:用户提供坐标,未核验"),
|
|
}
|
|
EN = {
|
|
"district_centroid": ("| Coordinates | District centre |", "- Coordinate source: district centre",
|
|
"- Coordinate precision: district centre, not the exact birth address"),
|
|
"user_entered": ("| Coordinates | The latitude and longitude you entered |",
|
|
"- Coordinate source: the latitude and longitude you entered",
|
|
"- Coordinate precision: user coordinates, unverified"),
|
|
}
|
|
|
|
|
|
def _render(case_id: str, source: str, language: str) -> str:
|
|
packet = deepcopy(public_chart_reports(case_id)[0])
|
|
packet["birth_provenance"] = {
|
|
**packet.get("birth_provenance", {}),
|
|
"coordinate_source": source,
|
|
"coordinate_precision": PROVENANCE[source],
|
|
}
|
|
if language == "en":
|
|
packet["report_language"] = "en"
|
|
return _pl9_export_markdown_for_edition(packet, "full_data")
|
|
|
|
|
|
@pytest.mark.parametrize("case_id", PUBLIC_REPORT_CASES)
|
|
@pytest.mark.parametrize("source", sorted(PROVENANCE))
|
|
def test_report_names_the_coordinate_source_in_both_editions(case_id, source):
|
|
chinese = _render(case_id, source, "zh")
|
|
english = _render(case_id, source, "en")
|
|
for line in ZH[source]:
|
|
assert line in chinese, line
|
|
for line in EN[source]:
|
|
assert line in english, line
|
|
# The row sits beside the coordinates it describes.
|
|
lines = chinese.splitlines()
|
|
row = lines.index(ZH[source][0])
|
|
assert lines[row - 1].startswith("| 经度 |")
|
|
# No raw codes reach the reader.
|
|
for code in ("district_centroid", "user_entered", "city_centroid", "user_reported"):
|
|
assert code not in chinese
|
|
assert code not in english
|
|
|
|
|
|
def test_a_packet_without_the_flag_shows_no_coordinate_row():
|
|
_, chinese, english = public_chart_reports("steve_jobs_1955_aa")
|
|
assert "| 坐标 |" not in chinese
|
|
assert "| Coordinates |" not in english
|