← Về thư mục
scripts/test_ars_apply_revision_patch.py
- _hash_of · function · L56-L57 — def _hash_of(anchored: str, block_id: str) -> str
- base_patch · function · L60-L67 — def _base_patch(anchored: str, ops: list[dict], round: int = 1) -> dict
- ApplyHarness · class · L70-L100 — class ApplyHarness(unittest.TestCase)
- setUp · method · L73-L78 — def setUp(self)
- _write · method · L80-L82 — def _write(self, anchored: str, patch: dict) -> None
- _run · method · L84-L93 — def _run(self, **kwargs) -> dict
- _assert_no_artifacts · method · L95-L97 — def _assert_no_artifacts(self)
- anchored_fixture · method · L99-L100 — def anchored_fixture(self, with_frontmatter: bool = False) -> str
- TestReplaceBlock · class · L103-L169 — class TestReplaceBlock(ApplyHarness)
- test_replace_keeps_marker_and_preserves_everything_else · method · L104-L126 — def test_replace_keeps_marker_and_preserves_everything_else(self)
- test_multi_block_replace_head_keeps_id_rest_fresh · method · L128-L150 — def test_multi_block_replace_head_keeps_id_rest_fresh(self)
- test_replace_final_block_without_trailing_newline · method · L152-L169 — def test_replace_final_block_without_trailing_newline(self)
- TestInsertAfter · class · L172-L242 — class TestInsertAfter(ApplyHarness)
- test_insert_after_multi_paragraph_fresh_ids · method · L173-L200 — def test_insert_after_multi_paragraph_fresh_ids(self)
- test_doc_body_start_with_frontmatter · method · L202-L222 — def test_doc_body_start_with_frontmatter(self)
- test_doc_body_start_without_frontmatter · method · L224-L242 — def test_doc_body_start_without_frontmatter(self)
- TestDeleteBlock · class · L245-L283 — class TestDeleteBlock(ApplyHarness)
- test_delete_removes_block_and_marker · method · L246-L265 — def test_delete_removes_block_and_marker(self)
- test_delete_last_block_leaves_no_trailing_blank · method · L267-L283 — def test_delete_last_block_leaves_no_trailing_blank(self)
- TestPhase1Rejections · class · L286-L616 — class TestPhase1Rejections(ApplyHarness)
- test_stale_base_hash_rejects_whole_patch · method · L287-L305 — def test_stale_base_hash_rejects_whole_patch(self)
- test_one_stale_op_rejects_whole_patch_two_phase · method · L307-L329 — def test_one_stale_op_rejects_whole_patch_two_phase(self)
- test_unknown_block_id · method · L331-L347 — def test_unknown_block_id(self)
- test_duplicate_target_any_role · method · L349-L372 — def test_duplicate_target_any_role(self)
- test_marker_in_new_text_rejected · method · L374-L391 — def test_marker_in_new_text_rejected(self)
- test_new_text_unsupported_construct_rejected_by_name · method · L393-L413 — def test_new_text_unsupported_construct_rejected_by_name(self)
- test_schema_rejects_hashless_op_of_any_other_shape · method · L415-L431 — def test_schema_rejects_hashless_op_of_any_other_shape(self)
- test_schema_rejects_doc_body_start_with_hash · method · L433-L450 — def test_schema_rejects_doc_body_start_with_hash(self)
- test_duplicate_doc_body_start_rejected · method · L452-L463 — def test_duplicate_doc_body_start_rejected(self)
- test_output_naming_base_is_rejected · method · L465-L490 — def test_output_naming_base_is_rejected(self)
- test_report_naming_base_is_rejected · method · L492-L518 — def test_report_naming_base_is_rejected(self)
- test_existing_output_is_rejected_not_overwritten · method · L520-L540 — def test_existing_output_is_rejected_not_overwritten(self)
- test_report_naming_output_is_rejected · method · L542-L566 — def test_report_naming_output_is_rejected(self)
- test_report_write_failure_removes_output · method · L568-L596 — def test_report_write_failure_removes_output(self)
- fail_on_report · function · L586-L589 — def fail_on_report(path, data)
- test_unanchored_base_block_cannot_be_targeted · method · L598-L616 — def test_unanchored_base_block_cannot_be_targeted(self): # A base with an unlabeled block parses fine; only labeled blocks # are addressable. (Phase 1 sees the unknown ID.)
- TestStructuralTriggers · class · L619-L785 — class TestStructuralTriggers(ApplyHarness)
- _heading_patch · method · L620-L633 — def _heading_patch(self, anchored: str) -> dict
- test_heading_op_refused_without_acknowledge · method · L635-L641 — def test_heading_op_refused_without_acknowledge(self)
- test_heading_op_proceeds_with_acknowledge_and_is_recorded · method · L643-L649 — def test_heading_op_proceeds_with_acknowledge_and_is_recorded(self)
- test_insert_after_heading_anchor_exempt_when_no_heading_segments · method · L651-L673 — def test_insert_after_heading_anchor_exempt_when_no_heading_segments(self): # #424 heading-anchor exemption: an insert_after ANCHORED on a # heading does not flag when its new_text contains no heading — # the heading's bytes are untouched and "insert body text after a # section heading" is the most common legitimate insertion.
- test_insert_after_heading_anchor_with_heading_segments_still_fires · method · L675-L695 — def test_insert_after_heading_anchor_with_heading_segments_still_fires(self): # The exemption is anchor-only: heading-bearing new_text flags via # its segments regardless of what the anchor is.
- test_section_count_change_fires · method · L697-L714 — def test_section_count_change_fires(self)
- test_touched_ratio_triggers_only_with_threshold · method · L716-L740 — def test_touched_ratio_triggers_only_with_threshold(self)
- test_cli_default_threshold_is_the_ship_decision · method · L742-L763 — def test_cli_default_threshold_is_the_ship_decision(self): # #424 ship decision: the CLI defaults to 0.6 and the comparator # is strict — 0.75 > 0.6 fires without any flag passed.
- test_nonfinite_and_out_of_range_threshold_rejected_at_cli · method · L765-L785 — def test_nonfinite_and_out_of_range_threshold_rejected_at_cli(self): # codex P2: NaN makes
ratio > NaN silently False (disables the # trigger off the documented 1.0 path); inf disables; negatives # over-trigger. argparse must reject all of them before run().
- TestPureMove · class · L788-L833 — class TestPureMove(ApplyHarness)
- test_byte_equal_relocation_recorded · method · L789-L812 — def test_byte_equal_relocation_recorded(self)
- test_reworded_relocation_not_claimed_as_pure · method · L814-L833 — def test_reworded_relocation_not_claimed_as_pure(self)
- TestAtomicityAndSelfCheck · class · L836-L884 — class TestAtomicityAndSelfCheck(ApplyHarness)
- test_injected_rename_failure_leaves_no_artifacts · method · L837-L859 — def test_injected_rename_failure_leaves_no_artifacts(self)
- test_post_apply_output_reparses_with_unique_markers · method · L861-L884 — def test_post_apply_output_reparses_with_unique_markers(self)
- TestCliExitCodes · class · L887-L927 — class TestCliExitCodes(ApplyHarness)
- test_ok_is_0_rejection_is_2_structural_is_3 · method · L888-L927 — def test_ok_is_0_rejection_is_2_structural_is_3(self)
- TestByteIdentityProperty · class · L930-L1050 — class TestByteIdentityProperty(ApplyHarness)
- _random_patch · method · L939-L983 — def _random_patch(self, anchored: str, rng: random.Random) -> dict
- test_untouched_blocks_byte_identical_across_random_patches · method · L985-L1050 — def test_untouched_blocks_byte_identical_across_random_patches(self): # Fixture variants rotate LF / frontmatter / CRLF / no-final-EOL # so newline-byte regressions (CRLF translation, EOF handling) # cannot hide behind text-mode reads: all comparisons run over # translation-free decodes of the raw output bytes.