66
77from tests .golden import check_semver_bump as csb
88
9+ # A rename emits one D + one A change.
10+ _RENAME_CHANGE_COUNT = 2
11+
912
1013def test_no_changes_passes ():
1114 rc , msg = csb .check (
@@ -80,23 +83,21 @@ def test_parser_rename_emits_delete_plus_add(monkeypatch):
8083 split into a deletion of OLD and an addition of NEW so the gate sees
8184 the source go away."""
8285 fake_diff = (
83- "R100\t tests/golden/templates/x/old/expected.build.yaml"
84- "\t tests/golden/templates/x/new/expected.build.yaml\n "
86+ "R100\t tests/golden/templates/x/old/expected.build.yaml" "\t tests/golden/templates/x/new/expected.build.yaml\n "
8587 )
8688 monkeypatch .setattr (csb .subprocess , "check_output" , lambda * a , ** kw : fake_diff )
8789 changes = csb ._git_changed_files ("base" , "head" )
8890 assert csb .Change ("tests/golden/templates/x/old/expected.build.yaml" , "D" ) in changes
8991 assert csb .Change ("tests/golden/templates/x/new/expected.build.yaml" , "A" ) in changes
90- assert len (changes ) == 2
92+ assert len (changes ) == _RENAME_CHANGE_COUNT
9193
9294
9395def test_parser_copy_treated_as_addition_only (monkeypatch ):
9496 """A `C<score>\\ tOLD\\ tNEW` line means the source still exists, only
9597 the new target is added. The gate must classify this as A only — not
9698 let it silently bypass via an unrecognized "C" status."""
9799 fake_diff = (
98- "C100\t tests/golden/templates/x/old/expected.build.yaml"
99- "\t tests/golden/templates/x/new/expected.build.yaml\n "
100+ "C100\t tests/golden/templates/x/old/expected.build.yaml" "\t tests/golden/templates/x/new/expected.build.yaml\n "
100101 )
101102 monkeypatch .setattr (csb .subprocess , "check_output" , lambda * a , ** kw : fake_diff )
102103 changes = csb ._git_changed_files ("base" , "head" )
@@ -112,8 +113,7 @@ def test_copy_of_existing_pin_does_not_bypass_gate(monkeypatch):
112113 addition — feeding only A's through `check()` correctly returns 0,
113114 but the path must NOT be silently dropped."""
114115 fake_diff = (
115- "C100\t tests/golden/templates/x/old/expected.build.yaml"
116- "\t tests/golden/templates/x/new/expected.build.yaml\n "
116+ "C100\t tests/golden/templates/x/old/expected.build.yaml" "\t tests/golden/templates/x/new/expected.build.yaml\n "
117117 )
118118 monkeypatch .setattr (csb .subprocess , "check_output" , lambda * a , ** kw : fake_diff )
119119 changes = csb ._git_changed_files ("base" , "head" )
0 commit comments