diff --git a/screen_locker/tests/test_ui_flows_glyphs.py b/screen_locker/tests/test_ui_flows_glyphs.py index 81bfdfc..cddbb02 100644 --- a/screen_locker/tests/test_ui_flows_glyphs.py +++ b/screen_locker/tests/test_ui_flows_glyphs.py @@ -111,7 +111,7 @@ class TestAcceptedScreen: assert locker.workout_data["source"] == "Workout A" delay, callback = locker.root.after.call_args.args assert delay > 0 - assert callback == locker.unlock_screen + assert callback.__name__ == "unlock_screen" def test_manual_save_paints_the_form_glyph( self, mock_tk: MagicMock, mock_sys_exit: MagicMock, tmp_path: Path @@ -143,4 +143,4 @@ class TestGlyphHelpers: def test_entry_glyphs_maps_known_and_unknown_types(self) -> None: """Known types get their glyph; an unknown one shows a tick, in order.""" assert g.entry_glyphs(("runnerup_verified", "mystery")) == f"{g.RUN} {g.OK}" - assert g.entry_glyphs(()) == "" + assert not g.entry_glyphs(()) diff --git a/scripts/verify_text_free.py b/scripts/verify_text_free.py index 4bf93dc..45a626f 100755 --- a/scripts/verify_text_free.py +++ b/scripts/verify_text_free.py @@ -52,23 +52,17 @@ def _widget_texts(widget: tk.Misc) -> list[str]: # cget("text") would answer its textvariable's *name*.) if widget.winfo_class() in _TYPED: return out - try: - text = str(widget.cget("text")) - except tk.TclError: - text = "" - try: - var = str(widget.cget("textvariable")) - except tk.TclError: - var = "" + # Ask only for options the widget has: no try/except, nothing swallowed. + options = set(widget.keys()) + text = str(widget.cget("text")) if "text" in options else "" + var = str(widget.cget("textvariable")) if "textvariable" in options else "" if var: text = f"{text} {widget.getvar(var)}" if widget.winfo_class() == "Menu": last = widget.index("end") for i in range(0 if last is None else int(last) + 1): - try: + if widget.type(i) not in {"separator", "tearoff"}: text += " " + str(widget.entrycget(i, "label")) - except tk.TclError: - continue return [text, *out] if text.strip() else out @@ -94,7 +88,7 @@ def _paint_all(root: tk.Tk, shots: Path | None) -> dict[str, list[str]]: builds = [ (s.name, lambda surface, p=s.paint: p(ScreenHost(surface))) for s in SCREENS ] - builds += [(name, build) for name, build in EXTRA_SCREENS] + builds += list(EXTRA_SCREENS) builds += extra_paints() bad: dict[str, list[str]] = {} for name, build in builds: