Orchestrata Ultimate › Tests › Reference › session › test_context_coverage
Tests reference — tests/session/test_context_coverage.py
Module of tests/session, split out because the directory page would be too large.
Prose pending.
tests/session/test_context_coverage.py
source · 49 tests · 571 lines
Coverage tests for session.context — ContextFileManager.
Covers: session.context, session.models
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestJsonRoundTrip |
59 | Test JSON serialization and deserialization. |
| method | TestJsonRoundTrip.test_write_and_read_json |
62 | Test writing and reading JSON produces identical data. |
| method | TestJsonRoundTrip.test_json_file_is_valid_json |
86 | Test the written JSON file is valid JSON. |
| class | TestInitialize |
99 | Test initialize method. |
| method | TestInitialize.test_initialize_creates_both_files |
102 | Test initialize creates both JSON and markdown files. |
| method | TestInitialize.test_initialize_default_state |
108 | Test initialize with default state values. |
| method | TestInitialize.test_initialize_custom_state |
114 | Test initialize with custom state. |
| class | TestReadWrite |
125 | Test read and write methods. |
| method | TestReadWrite.test_read_nonexistent_raises |
128 | Test read raises FileNotFoundError when no context. |
| method | TestReadWrite.test_read_after_write |
133 | Test read returns data written by write. |
| method | TestReadWrite.test_write_preserves_sessions |
138 | Test write preserves all sessions in JSON. |
| class | TestStateOperations |
149 | Test state read and update. |
| method | TestStateOperations.test_read_state |
152 | Test read_state returns current state. |
| method | TestStateOperations.test_update_state |
157 | Test update_state modifies fields. |
| method | TestStateOperations.test_update_state_ignores_unknown_fields |
163 | Test update_state ignores unknown field names. |
| method | TestStateOperations.test_update_state_persists |
170 | Test update_state changes are persisted to disk. |
| class | TestSessionOperations |
180 | Test session CRUD operations. |
| method | TestSessionOperations.test_add_session |
183 | Test adding a session. |
| method | TestSessionOperations.test_read_latest_session |
190 | Test getting the latest session. |
| method | TestSessionOperations.test_read_latest_session_empty |
199 | Test latest session returns None when empty. |
| method | TestSessionOperations.test_update_session |
204 | Test updating an existing session. |
| method | TestSessionOperations.test_update_session_not_found |
211 | Test updating non-existent session returns None. |
| method | TestSessionOperations.test_update_session_persists |
216 | Test session updates are persisted. |
| class | TestWorkItemOperations |
227 | Test work item CRUD operations. |
| method | TestWorkItemOperations.test_add_work_item |
230 | Test adding a work item. |
| method | TestWorkItemOperations.test_complete_work_item |
238 | Test completing a work item. |
| method | TestWorkItemOperations.test_complete_nonexistent_item |
246 | Test completing non-existent item returns False. |
| class | TestArchiveOldSessions |
255 | Test session archiving to context.history.md. |
| method | TestArchiveOldSessions.test_no_archive_when_few_sessions |
258 | Test no archiving when sessions <= SESSION_LIMIT. |
| method | TestArchiveOldSessions.test_archive_when_many_sessions |
266 | Test archiving happens when sessions > SESSION_LIMIT. |
| method | TestArchiveOldSessions.test_archive_idempotent |
275 | Test calling archive multiple times doesn't duplicate. |
| method | TestArchiveOldSessions.test_archive_creates_new_history_file |
285 | Test archive creates history file after enough sessions. |
| class | TestGetMaxSessionFromHistory |
299 | Test _get_max_session_from_history. |
| method | TestGetMaxSessionFromHistory.test_no_history_file |
302 | Test returns -1 when no history file. |
| method | TestGetMaxSessionFromHistory.test_empty_history_file |
306 | Test returns -1 when history file has no sessions. |
| method | TestGetMaxSessionFromHistory.test_history_with_sessions |
311 | Test returns max session number from history. |
| class | TestNextSessionNum |
322 | Test next_session_num computation. |
| method | TestNextSessionNum.test_empty_context |
325 | Test next session num starts at 0 for empty context. |
| method | TestNextSessionNum.test_with_sessions |
330 | Test next session num is max + 1. |
| method | TestNextSessionNum.test_considers_history_file |
337 | Test next_session_num considers history file. |
| class | TestVerifyHistoryIntegrity |
347 | Test verify_history_integrity method. |
| method | TestVerifyHistoryIntegrity.test_valid_empty_context |
350 | Test integrity check passes for empty context. |
| method | TestVerifyHistoryIntegrity.test_detects_gaps |
357 | Test gap detection in session numbering. |
| method | TestVerifyHistoryIntegrity.test_detects_duplicates |
366 | Test duplicate detection across json and history. |
| method | TestVerifyHistoryIntegrity.test_continuity_violation |
374 | Test continuity check: max(history) < min(context). |
| method | TestVerifyHistoryIntegrity.test_sync_ok_after_write |
382 | Test sync check passes right after write. |
| class | TestParseCurrentState |
392 | Test markdown parsing of Current State block. |
| method | TestParseCurrentState.test_parse_state_fields |
395 | Test parsing state fields from markdown. |
| method | TestParseCurrentState.test_parse_state_missing_section |
416 | Test parsing when Current State section is missing. |
| class | TestParseCarryoverTasks |
426 | Test markdown parsing of Carryover Tasks block. |
| method | TestParseCarryoverTasks.test_parse_simple_tasks |
429 | Test parsing simple task items. |
| method | TestParseCarryoverTasks.test_parse_checkbox_tasks |
437 | Test parsing checkbox-style tasks. |
| method | TestParseCarryoverTasks.test_parse_priority_tasks |
447 | Test parsing tasks with priority annotations. |
| method | TestParseCarryoverTasks.test_parse_tasks_with_notes |
460 | Test parsing tasks with parenthesized notes. |
| method | TestParseCarryoverTasks.test_parse_skips_none_marker |
467 | Test {none} items are skipped. |
| method | TestParseCarryoverTasks.test_parse_missing_carryover_section |
474 | Test no error when carryover section missing. |
| class | TestParseFull |
484 | Test full markdown parsing. |
| method | TestParseFull.test_parse_complete_markdown |
487 | Test parsing a complete context markdown document. |
| method | TestParseFull.test_parse_empty_content |
509 | Test parsing empty content returns default ContextData. |
| class | TestParseSessionRecord |
520 | Test session record parsing from markdown regex match. |
| method | TestParseSessionRecord.test_parse_session_with_focus |
523 | Test parsing a session record with focus line. |
| method | TestParseSessionRecord.test_parse_session_with_next_steps |
538 | Test parsing session with Next Steps section. |
| class | TestMarkdownFallbackRead |
558 | Test reading from markdown when JSON is missing. |
| method | TestMarkdownFallbackRead.test_read_falls_back_to_markdown |
561 | Test read parses markdown when JSON doesn't exist. |