Orchestrata Ultimate › Tests › Reference › refactor

Tests reference — tests/refactor

tests/refactor — 58 test modules, 1115 test functions (cumulative over subdirectories). Source tree: tests/refactor at commit 8a2cb42ad. Generated from the tests AST snapshot by scripts/gen-data-pages.py.

Prose pending.

Subdirectories

Directory Modules Tests
codemod/ 49 1003
ctok/ 6 83

Modules

Module Tests Covers
test_agent.py 8 3
test_tools.py 21 1

Module details

tests/refactor/test_agent.py

source · 8 tests · 230 lines

SPEC-103 FR-005/006/007: the refactor tool-use loop and entry point.

Covers: core.protocols.providers, llm.client, refactor.agent

Kind Name Line Description
function test_system_prompt_observe_before_mutate_and_verify 90
function test_loop_completes_immediately_on_no_tool_calls 103 REQ-103-018: content with no tool calls terminates as 'completed'.
function test_loop_edits_real_file_then_completes 119 REQ-103-017/019/023: executes tool calls, preserves history across turns,
function test_loop_hits_max_iterations 155 REQ-103-018 / ERR-103-006: an endlessly-tool-calling model stops at the
function test_loop_survives_tool_errors 167 TST-103-006 / ERR-103-008: unknown tool + bad args return ERROR strings;
function test_loop_records_verified_from_run_check 186 REQ-103-023: run_check exit=0 is recorded as verified=True.
function test_refactor_sync_wrapper_returns_error_on_exception 207 ERR-103-007: a provider failure surfaces as status='error', not a raise.
function test_refactor_sync_wrapper_completes 220 REQ-103-022: the sync wrapper runs the loop and returns its result.

tests/refactor/test_tools.py

source · 21 tests · 152 lines

SPEC-103 refactor tool registry tests (TST-103-001/002/005).

Covers: refactor.tools

Kind Name Line Description
function test_read_file_returns_contents 29
function test_read_file_missing_returns_error 34
function test_list_dir_lists_entries_and_skips_pycache 38
function test_grep_finds_substring_with_location 45
function test_grep_no_match_message 50
function test_ast_outline_lists_classes_and_functions 54
function test_ast_outline_syntax_error_returns_error 61
function test_edit_file_unique_match_applies 66
function test_edit_file_not_found_is_error 72
function test_edit_file_non_unique_is_error 76
function test_write_file_creates 81
function test_run_check_whitelisted_compiles 86
function test_run_check_non_whitelisted_refused 91
function test_dispatch_routes_valid_tool 99
function test_dispatch_unknown_tool_errors 103
function test_dispatch_bad_arguments_errors 107
function test_dispatch_never_raises_on_traversal 112
function test_path_traversal_blocked 121
function test_write_outside_sandbox_blocked 125
function test_run_check_blocks_network_command 131
function test_tool_schemas_are_well_formed 135

Support files

Fixtures, package markers and helpers without test functions.