Orchestrata Ultimate › Tests › Reference › session › test_prolog_interface

Tests reference — tests/session/test_prolog_interface.py

Module of tests/session, split out because the directory page would be too large.

Prose pending.

tests/session/test_prolog_interface.py

source · 79 tests · 955 lines

Tests for prolog_interface.py - PrologSessionInterface class.

Covers: core.prolog_adapter, session.prolog_interface

Kind Name Line Description
class TestPrologSessionInterfaceInit 117 Tests for initialization.
method TestPrologSessionInterfaceInit.test_init_minimal 120 Test initialization with path only.
method TestPrologSessionInterfaceInit.test_init_with_engine 127 Test initialization with engine.
method TestPrologSessionInterfaceInit.test_init_string_path 133 Test initialization with string path.
method TestPrologSessionInterfaceInit.test_fact_generator_created 138 Test that fact generator is created.
class TestSetEngine 147 Tests for set_engine method.
method TestSetEngine.test_set_engine 150 Test setting engine.
method TestSetEngine.test_replace_engine 156 Test replacing engine.
class TestAssertSessionOpen 168 Tests for assert_session_open method.
method TestAssertSessionOpen.test_assert_session_open_no_engine 171 Test assert_session_open returns False without engine.
method TestAssertSessionOpen.test_assert_session_open_with_engine 176 Test assert_session_open asserts a session/4 fact and returns True.
method TestAssertSessionOpen.test_assert_session_open_handles_prolog_syntax_error 186 A session_id that breaks Prolog quoted-atom syntax is handled.
class TestRetractSession 202 Tests for retract_session method.
method TestRetractSession.test_retract_session_no_engine 205 Test retract_session returns False without engine.
method TestRetractSession.test_retract_session_nonexistent 210 Test retracting a session that was never asserted returns False.
method TestRetractSession.test_retract_session_removes_opened_session 215 Test retract_session removes a previously-opened session.
method TestRetractSession.test_retract_session_handles_prolog_syntax_error 223 A malformed session_id is handled without raising.
class TestAssertSessionFact 232 Tests for assert_session_fact method.
method TestAssertSessionFact.test_assert_session_fact_no_engine 235 Test assert_session_fact returns False without engine.
method TestAssertSessionFact.test_assert_session_fact_with_engine 240 Test assert_session_fact asserts a session_fact/4 fact.
method TestAssertSessionFact.test_assert_session_fact_default_source 252 Test assert_session_fact defaults source to empty string.
method TestAssertSessionFact.test_assert_session_fact_escapes_embedded_quotes 262 Fact terms/sources with embedded single quotes round-trip correctly.
method TestAssertSessionFact.test_assert_session_fact_handles_prolog_syntax_error 273 A malformed session_id is handled without raising.
class TestQuerySession 286 Tests for query_session method.
method TestQuerySession.test_query_session_no_engine 289 Test query_session returns empty list without engine.
method TestQuerySession.test_query_session_nonexistent 294 Test querying a session that does not exist returns empty list.
method TestQuerySession.test_query_session_handles_prolog_syntax_error 299 A malformed session_id is handled without raising.
class TestQuerySessionFacts 308 Tests for query_session_facts method.
method TestQuerySessionFacts.test_query_session_facts_no_engine 311 Test query_session_facts returns empty list without engine.
method TestQuerySessionFacts.test_query_session_facts_with_engine 316 Test query_session_facts returns all facts for a session.
method TestQuerySessionFacts.test_query_session_facts_nonexistent 329 Test querying facts for a session with none recorded.
method TestQuerySessionFacts.test_query_session_facts_handles_prolog_syntax_error 334 A malformed session_id is handled without raising.
class TestSyncFacts 345 Tests for sync_facts method.
method TestSyncFacts.test_sync_facts_no_engine 348 Test sync_facts returns 0 without engine.
method TestSyncFacts.test_sync_facts_with_engine 353 Test sync_facts asserts facts to engine.
method TestSyncFacts.test_sync_facts_caches_facts 359 Test that sync_facts caches facts.
method TestSyncFacts.test_sync_facts_multiple_times 365 Test syncing facts multiple times.
class TestClearFacts 377 Tests for clear_facts method.
method TestClearFacts.test_clear_facts_no_engine 380 Test clear_facts does nothing without engine.
method TestClearFacts.test_clear_facts_with_engine 385 Test clear_facts retracts predicates.
class TestQuerySessions 402 Tests for query_sessions method.
method TestQuerySessions.test_query_sessions_no_engine 405 Test query_sessions returns empty without engine.
method TestQuerySessions.test_query_sessions_with_engine 410 Test query_sessions with engine.
method TestQuerySessions.test_query_sessions_with_purpose_contains 423 Test query_sessions with purpose_contains filter.
method TestQuerySessions.test_query_sessions_with_seq 432 Test query_sessions with seq filter.
method TestQuerySessions.test_query_sessions_handles_prolog_syntax_error 441 A criteria value that breaks Prolog syntax is caught, not raised.
class TestQueryWork 456 Tests for query_work method.
method TestQueryWork.test_query_work_no_engine 459 Test query_work returns empty without engine.
method TestQueryWork.test_query_work_with_engine 464 Test query_work with engine.
method TestQueryWork.test_query_work_with_state 475 Test query_work with state filter.
method TestQueryWork.test_query_work_with_priority 488 Test query_work with priority filter.
method TestQueryWork.test_query_work_handles_prolog_syntax_error 500 A criteria value that breaks Prolog syntax is caught, not raised.
class TestExportFacts 515 Tests for export_facts method.
method TestExportFacts.test_export_facts 518 Test exporting facts to file.
method TestExportFacts.test_export_facts_content 525 Test exported facts content.
class TestReloadFacts 536 Tests for reload_facts method.
method TestReloadFacts.test_reload_facts_no_engine 539 Test reload_facts without engine.
method TestReloadFacts.test_reload_facts_with_engine 544 Test reload_facts clears and syncs.
class TestGetCachedFacts 556 Tests for get_cached_facts method.
method TestGetCachedFacts.test_get_cached_facts_empty 559 Test get_cached_facts returns empty initially.
method TestGetCachedFacts.test_get_cached_facts_after_sync 564 Test get_cached_facts after sync.
method TestGetCachedFacts.test_get_cached_facts_returns_copy 570 Test get_cached_facts returns a copy.
class TestFactExists 584 Tests for fact_exists method.
method TestFactExists.test_fact_exists_no_engine 587 Test fact_exists returns False without engine.
method TestFactExists.test_fact_exists_with_engine 592 Test fact_exists with engine.
method TestFactExists.test_fact_exists_nonexistent 599 Test fact_exists for nonexistent fact.
class TestExecuteQuery 609 Tests for execute_query method.
method TestExecuteQuery.test_execute_query_no_engine 612 Test execute_query returns empty without engine.
method TestExecuteQuery.test_execute_query_with_engine 617 Test execute_query with engine.
method TestExecuteQuery.test_execute_query_invalid 627 Test execute_query with invalid query.
class TestSessionQuery 637 Tests for _session_query method.
method TestSessionQuery.test_session_query_default 640 Test default session query.
method TestSessionQuery.test_session_query_with_purpose_contains 645 Test session query with purpose_contains.
method TestSessionQuery.test_session_query_with_seq 650 Test session query with seq.
class TestWorkQuery 659 Tests for _work_query method.
method TestWorkQuery.test_work_query_default 662 Test default work query.
method TestWorkQuery.test_work_query_with_state 667 Test work query with state.
method TestWorkQuery.test_work_query_with_priority 672 Test work query with priority.
method TestWorkQuery.test_work_query_with_both 677 Test work query with state and priority.
class TestStats 687 Tests for stats method.
method TestStats.test_stats_no_engine 690 Test stats without engine.
method TestStats.test_stats_with_engine 697 Test stats with engine.
method TestStats.test_stats_after_sync 704 Test stats after syncing facts.
class TestPrologInterfaceIntegration 715 Integration tests for PrologSessionInterface.
method TestPrologInterfaceIntegration.test_full_workflow 718 Test full workflow: sync, query, export.
method TestPrologInterfaceIntegration.test_reload_workflow 742 Test reload workflow.
method TestPrologInterfaceIntegration.test_query_after_clear 756 Test queries after clearing facts.
class TestEdgeCases 772 Edge case tests.
method TestEdgeCases.test_empty_project 775 Test with empty project directory.
method TestEdgeCases.test_no_context_file 789 Test with no context.md file - implementation handles gracefully.
method TestEdgeCases.test_empty_context_file 805 Test with empty context.md file.
method TestEdgeCases.test_special_characters_in_path 816 Test with special characters in path.
method TestEdgeCases.test_sync_with_exception_handling 829 Test sync handles assertion errors gracefully through public API.
class TestPrologEngineOperations 850 Tests specific to Prolog engine operations.
method TestPrologEngineOperations.test_assertz_called 853 Test that assertz is called during sync.
method TestPrologEngineOperations.test_retractall_called 859 Test that retractall is called during clear.
method TestPrologEngineOperations.test_query_returns_dict 871 Test that queries return dictionaries.
class TestExceptionHandling 883 Tests for exception handling in various methods.
method TestExceptionHandling.test_sync_facts_handles_bad_fact 886 Test sync_facts handles malformed facts gracefully.
class TestWithoutPyswip 920 Tests that run without pyswip dependency.
method TestWithoutPyswip.test_interface_without_engine_is_functional 923 Test interface works without engine.
method TestWithoutPyswip.test_query_builders_work_without_engine 939 Test query builders work without engine.
method TestWithoutPyswip.test_export_works_without_engine 949 Test export works without engine.