@@ -42,8 +42,8 @@ def test_cannot_expire_protected_head_snapshot(table_v2: Table) -> None:
4242 assert any (ref .snapshot_id == HEAD_SNAPSHOT for ref in table_v2 .metadata .refs .values ())
4343
4444 # Attempt to expire the HEAD snapshot and expect a ValueError
45- with pytest .raises (ValueError , match = f"Snapshot with ID { HEAD_SNAPSHOT } is protected and cannot be expired ." ):
46- table_v2 .expire_snapshots ().expire_snapshot_by_id (HEAD_SNAPSHOT ).commit ()
45+ with pytest .raises (ValueError , match = f"Cannot expire snapshot { HEAD_SNAPSHOT } as it is referenced by a branch or tag ." ):
46+ table_v2 .maintenance . expire_snapshots ().by_id (HEAD_SNAPSHOT ).commit ()
4747
4848 table_v2 .catalog .commit_table .assert_not_called ()
4949
@@ -65,8 +65,8 @@ def test_cannot_expire_tagged_snapshot(table_v2: Table) -> None:
6565 )
6666 assert any (ref .snapshot_id == TAGGED_SNAPSHOT for ref in table_v2 .metadata .refs .values ())
6767
68- with pytest .raises (ValueError , match = f"Snapshot with ID { TAGGED_SNAPSHOT } is protected and cannot be expired ." ):
69- table_v2 .expire_snapshots ().expire_snapshot_by_id (TAGGED_SNAPSHOT ).commit ()
68+ with pytest .raises (ValueError , match = f"Cannot expire snapshot { TAGGED_SNAPSHOT } as it is referenced by a branch or tag ." ):
69+ table_v2 .maintenance . expire_snapshots ().by_id (TAGGED_SNAPSHOT ).commit ()
7070
7171 table_v2 .catalog .commit_table .assert_not_called ()
7272
@@ -98,7 +98,7 @@ def test_expire_unprotected_snapshot(table_v2: Table) -> None:
9898 assert all (ref .snapshot_id != EXPIRE_SNAPSHOT for ref in table_v2 .metadata .refs .values ())
9999
100100 # Expire the snapshot
101- table_v2 .expire_snapshots ().expire_snapshot_by_id (EXPIRE_SNAPSHOT ).commit ()
101+ table_v2 .maintenance . expire_snapshots ().by_id (EXPIRE_SNAPSHOT ).commit ()
102102
103103 table_v2 .catalog .commit_table .assert_called_once ()
104104 remaining_snapshots = table_v2 .metadata .snapshots
@@ -114,7 +114,7 @@ def test_expire_nonexistent_snapshot_raises(table_v2: Table) -> None:
114114 table_v2 .metadata = table_v2 .metadata .model_copy (update = {"refs" : {}})
115115
116116 with pytest .raises (ValueError , match = f"Snapshot with ID { NONEXISTENT_SNAPSHOT } does not exist." ):
117- table_v2 .expire_snapshots ().expire_snapshot_by_id (NONEXISTENT_SNAPSHOT ).commit ()
117+ table_v2 .maintenance . expire_snapshots ().by_id (NONEXISTENT_SNAPSHOT ).commit ()
118118
119119 table_v2 .catalog .commit_table .assert_not_called ()
120120
@@ -152,7 +152,7 @@ def test_expire_snapshots_by_timestamp_skips_protected(table_v2: Table) -> None:
152152 )
153153 table_v2 .catalog .commit_table .return_value = mock_response
154154
155- table_v2 .expire_snapshots ().expire_snapshots_older_than (future_timestamp ).commit ()
155+ table_v2 .maintenance . expire_snapshots ().older_than (future_timestamp ).commit ()
156156 # Update metadata to reflect the commit (as in other tests)
157157 table_v2 .metadata = mock_response .metadata
158158
@@ -215,10 +215,10 @@ def test_expire_snapshots_by_ids(table_v2: Table) -> None:
215215 assert all (ref .snapshot_id not in (EXPIRE_SNAPSHOT_1 , EXPIRE_SNAPSHOT_2 ) for ref in table_v2 .metadata .refs .values ())
216216
217217 # Expire the snapshots
218- table_v2 .expire_snapshots ().expire_snapshots_by_ids ([EXPIRE_SNAPSHOT_1 , EXPIRE_SNAPSHOT_2 ]).commit ()
218+ table_v2 .maintenance . expire_snapshots ().by_ids ([EXPIRE_SNAPSHOT_1 , EXPIRE_SNAPSHOT_2 ]).commit ()
219219
220220 table_v2 .catalog .commit_table .assert_called_once ()
221221 remaining_snapshots = table_v2 .metadata .snapshots
222222 assert EXPIRE_SNAPSHOT_1 not in remaining_snapshots
223223 assert EXPIRE_SNAPSHOT_2 not in remaining_snapshots
224- assert len (table_v2 .metadata .snapshots ) == 1
224+ assert len (table_v2 .metadata .snapshots ) == 1
0 commit comments