You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test(coverage): backfill WS edge cases and small auth/type/config branches (#134)
* test(coverage): backfill WS edge cases and small auth/type/config branches
Closes the test-coverage gaps from the Wave 5 audit:
- F-Q-09: pin KalshiAuth.from_key_path PermissionError and passphrase-protected
key branches (both surface helpful KalshiAuthError messages).
- F-Q-10: pin DollarDecimal / FixedPointCount TypeError fallback for unexpected
input types (list, dict). Raw TypeError surfaces with the offending type name.
- F-Q-12: pin KalshiClient.is_authenticated / AsyncKalshiClient.is_authenticated
true/false branches with and without auth.
- F-Q-13: replace flaky `await asyncio.sleep(0.2-0.3); assert` patterns in
ws/test_client.py and ws/test_integration.py with deterministic
`asyncio.Event` + `asyncio.wait_for(timeout=2.0)` waits. Callbacks signal
completion; tests no longer race the event loop.
- F-Q-15: cover two subs to the same channel (orderbook_delta) with different
tickers - distinct server_sids, distinct iterators, message-to-sid routing.
- F-Q-16: pin current `_join_tickers` behavior for non-string list elements
(bool, int) - existing crash with `argument of type 'X' is not iterable` is
captured so any future validation upgrade trips a test.
- F-Q-18: cover ws/client.py:197-203 sentinel-broadcast on permanent reconnect
failure. Force ws_max_retries=1 + reject_auth=True after first disconnect;
assert the iterator exits via StopAsyncIteration instead of hanging.
All changes are test-only. Net: +10 tests (1612 -> 1622). Wave 3's WS recv-loop,
dispatcher, and orderbook are unchanged - this only adds tests around them.
Closes#102
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* review(#134): trim multi-paragraph test docstrings per CLAUDE.md §3
Per bot review on #134:
- test_non_string_bool_element_raises_unhelpful_type_error: 6-line
docstring -> 1-line inline comment. The WHY (pin crash path so a
future fix trips this test) survives without the prose.
- test_types.py module docstring: 9 lines -> 1 line. The Pydantic-
BeforeValidator-doesn't-wrap note was redundant with the test names.
Skipped:
- test_non_string_int_element docstring is already one line; no change.
- session._sub_mgr access + insertion-order assumption are flagged as
informational by bot, not requested changes.
uv run pytest tests/test_base_helpers.py tests/test_types.py -q: 22
passed. ruff clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments