UX-46: test_ux46 points at MUTATION.md and reads rows without raising
checks / unit (pull_request) Successful in 44m51s
infra-pin / fresh (pull_request) Successful in 2s

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
glenn schrooyen
2026-10-22 03:41:18 +02:00
co-authored by Claude
parent 7a392a5367
commit c1809b4ca9
+12 -7
View File
@@ -14,6 +14,8 @@ showed English under Dutch titles (SAFETY-118 I-1, UX-44 I-2, UX-45 I-3).
3. The setting labels the Dutch notes quote are the labels in nl.yaml, and the 3. The setting labels the Dutch notes quote are the labels in nl.yaml, and the
peak forecast label has no "(W)", since any power unit is read. peak forecast label has no "(W)", since any power unit is read.
4. The rules above catch spoiled input. 4. The rules above catch spoiled input.
Mutating a module this file grades? Read MUTATION.md first (purge __pycache__).
""" """
import ast import ast
@@ -38,6 +40,7 @@ import ux13_demo as D # noqa: E402
from style_rules import sentences, text_problems, words # noqa: E402 from style_rules import sentences, text_problems, words # noqa: E402
from app import messages, uimodel as U, uitext, web # noqa: E402 from app import messages, uimodel as U, uitext, web # noqa: E402
from app.main import Controller # noqa: E402 from app.main import Controller # noqa: E402
from named_absence import field, nth, present # noqa: E402
from app.validate import (Note, note_text, setup_checks, # noqa: E402 from app.validate import (Note, note_text, setup_checks, # noqa: E402
config_notes) config_notes)
@@ -218,24 +221,26 @@ def attention(payload, rid):
c = make(ONE, soc=(62.0,), batt=(960.0,)) c = make(ONE, soc=(62.0,), batt=(960.0,))
c._peak_fc_fault = "kWh" c._peak_fc_fault = "kWh"
s_en, s_nl = c.status_payload(), c.status_payload(lang="nl") s_en, s_nl = c.status_payload(), c.status_payload(lang="nl")
_en = next(r for r in s_en["checks"] if r.get("id") == "peak_forecast") def fc_row(payload):
_nl = next(r for r in s_nl["checks"] if r.get("id") == "peak_forecast") return nth([r for r in payload["checks"] if r.get("id") == "peak_forecast"])
_en, _nl = fc_row(s_en), fc_row(s_nl)
check("Home, English: the peak forecast row is the English sentence", check("Home, English: the peak forecast row is the English sentence",
_en["text"] == messages.peak_forecast_unit("kWh") present(_en) and field(_en, "text") == messages.peak_forecast_unit("kWh")
and attention(s_en, "peak_forecast")["body"] and attention(s_en, "peak_forecast")["body"]
== messages.peak_forecast_unit("kWh")) == messages.peak_forecast_unit("kWh"))
check("Home, Dutch: the row, the Needs-attention entry and the title are " check("Home, Dutch: the row, the Needs-attention entry and the title are "
"Dutch", "Dutch",
_nl["text"] == messages.peak_forecast_unit("kWh", "nl") present(_nl) and field(_nl, "text") == messages.peak_forecast_unit("kWh", "nl")
and attention(s_nl, "peak_forecast")["body"] and attention(s_nl, "peak_forecast")["body"]
== messages.peak_forecast_unit("kWh", "nl") == messages.peak_forecast_unit("kWh", "nl")
and attention(s_nl, "peak_forecast")["title"] and attention(s_nl, "peak_forecast")["title"]
== uitext.words("nl")["home_words"]["attn"]["peak_forecast"]) == uitext.words("nl")["home_words"]["attn"]["peak_forecast"])
c._peak_fc_fault = "" c._peak_fc_fault = ""
_nl0 = next(r for r in c.status_payload(lang="nl")["checks"] _nl0 = fc_row(c.status_payload(lang="nl"))
if r.get("id") == "peak_forecast")
check("...and with no unit at all, the Dutch is the 'no unit' sentence", check("...and with no unit at all, the Dutch is the 'no unit' sentence",
_nl0["text"] == messages.peak_forecast_unit("", "nl") present(_nl0) and field(_nl0, "text") == messages.peak_forecast_unit("", "nl")
and messages.peak_forecast_unit("", "nl") and messages.peak_forecast_unit("", "nl")
!= messages.peak_forecast_unit("kWh", "nl")) != messages.peak_forecast_unit("kWh", "nl"))
check("a language that is not Dutch gets the English, and the default call " check("a language that is not Dutch gets the English, and the default call "