PyLimeRPC 0.2.0 — prompts.md Prompt 1-4

- responses.py: get_summary() (raw RPC get_summary), count_responses() ->
  frozen ResponseCounts(completed, incomplete, total), export_responses_auto()
  with automatic format fallback (xlsx -> xls -> csv) on IWriter errors
- utils.py: summary_counts_full() -> (completed, incomplete, total) with
  per-LS-version key fallbacks; summary_counts left untouched
- surveys.py: get_survey_by_sid() (dict | None), get_survey_info() ->
  frozen SurveyInfo(sid, title, active)
- tokens.py: documented that extra/custom token attributes (attribute_1, ...)
  pass through unchanged in add_participants/list_participants
- LsClient: get_summary, count_responses, get_survey_by_sid, get_survey_info,
  export_responses_auto; __all__ + re-exports updated
- README: new "Response counts & summary" section + usage examples
- .gitignore: prompts.md added (local-only docs, like werkdocument.md)
- version 0.1.0 -> 0.2.0 (__init__.py + pyproject.toml)
- tests: +27 FakeRpc unit tests (96 passed, 2 deselected)

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-20 11:56:03 +01:00
commit 6822eab467

View file

@ -16,6 +16,7 @@ from pylimerpc.utils import (
parse_responses_json,
raise_for_status,
summary_counts,
summary_counts_full,
to_int,
)
@ -71,6 +72,24 @@ def test_summary_counts_key_varianten():
assert summary_counts({}) == (None, None)
def test_summary_counts_full_basis():
summary = {"completed_responses": 14, "incomplete_responses": 41, "full_responses": 55}
assert summary_counts_full(summary) == (14, 41, 55)
def test_summary_counts_full_fallback_keys_and_total_sum():
# without full_responses → total = completed + incomplete
assert summary_counts_full({"responses_completed": "3", "in_progress_responses": 2}) == (3, 2, 5)
assert summary_counts_full({"completed": 1}) == (1, 0, 1)
# full_responses wins when present
assert summary_counts_full({"completed_responses": 2, "incomplete_responses": 3, "full_responses": 99}) == (2, 3, 99)
def test_summary_counts_full_missing_or_invalid_is_zero():
assert summary_counts_full({}) == (0, 0, 0)
assert summary_counts_full({"completed_responses": "abc", "incomplete_responses": None}) == (0, 0, 0)
def test_raise_for_status_auth():
with pytest.raises(LsAuthError):
raise_for_status({"status": "Invalid session key"}, "list_surveys")