6Regression Tests — ui_event_logger
7=====================================
11Verify that ``ui_event_logger`` imports cleanly, exposes the required public
12API surface, and registers callbacks correctly with custom event properties.
16- Confirm the module imports without error and exposes ``register_callbacks()``.
17- Confirm ``REQUIRED_STORE_ID`` has the expected constant value.
18- Confirm ``register_callbacks()`` accepts a custom ``UI_EVENT_PROPERTIES``
19 tuple with fewer properties than the default five.
31- All tests are skipped automatically when Dash is not installed.
32- Must not permanently modify oc_diagnostics global state.
33- Must restore all patched globals in finally blocks.
34- Must not start servers or require network access.
35- Must run deterministically across repeated invocations.
45_REPO_ROOT = os.path.normpath(os.path.join(os.path.dirname(__file__),
".."))
46if _REPO_ROOT
not in sys.path:
47 sys.path.insert(0, _REPO_ROOT)
52pytest.importorskip(
"dash", reason=
"Dash not installed")
54from dash
import Dash, dcc, html
65 """ui_event_logger module imports cleanly and exposes register_callbacks()."""
66 assert hasattr(_uelog,
"register_callbacks"), (
67 "ui_event_logger must expose register_callbacks()"
76 """REQUIRED_STORE_ID has the expected constant value."""
77 assert REQUIRED_STORE_ID ==
"debug-settings-data-store", (
78 f
"Expected 'debug-settings-data-store', got {REQUIRED_STORE_ID!r}"
87 """register_callbacks() accepts UI_EVENT_PROPERTIES with a reduced property set."""
88 old_props = _ud.UI_EVENT_PROPERTIES
90 _ud.UI_EVENT_PROPERTIES = (
"n_clicks",
"value")
92 app.layout = html.Div([
93 dcc.Store(id=
"debug-settings-data-store", storage_type=
"memory"),
95 register_callbacks(app)
96 assert len(app.callback_map) >= 1, (
97 "Expected at least one registered callback with 2-prop UI_EVENT_PROPERTIES"
100 _ud.UI_EVENT_PROPERTIES = old_props
test_ui_event_logger_import()
test_required_store_id_constant()
test_ui_logger_custom_props()