Skip to content

Commit e3cf96f

Browse files
kevinjqliuCopilot
andcommitted
test: derive expected sequence number from the fixture
The stale sequence-number test built the snapshot from the fixture's last_sequence_number but hardcoded 34 in the expected error message. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent ab75eb7 commit e3cf96f

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎tests/table/test_init.py‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1968,10 +1968,11 @@ def test_add_snapshot_update_fails_with_smaller_first_row_id(table_v3: Table) ->
19681968

19691969
@pytest.mark.parametrize("table", [lf("table_v2"), lf("table_v3")])
19701970
def test_add_snapshot_update_fails_with_stale_sequence_number(table: Table) -> None:
1971+
last_sequence_number = table.metadata.last_sequence_number
19711972
new_snapshot = Snapshot(
19721973
snapshot_id=25,
19731974
parent_snapshot_id=3055729675574597004,
1974-
sequence_number=table.metadata.last_sequence_number,
1975+
sequence_number=last_sequence_number,
19751976
timestamp_ms=1602638593590,
19761977
manifest_list="s3:/a/b/c.avro",
19771978
summary=Summary(Operation.APPEND),
@@ -1981,7 +1982,10 @@ def test_add_snapshot_update_fails_with_stale_sequence_number(table: Table) -> N
19811982

19821983
with pytest.raises(
19831984
ValueError,
1984-
match="Cannot add snapshot with sequence number 34 older than last sequence number 34",
1985+
match=(
1986+
f"Cannot add snapshot with sequence number {last_sequence_number} "
1987+
f"older than last sequence number {last_sequence_number}"
1988+
),
19851989
):
19861990
update_table_metadata(table.metadata, (AddSnapshotUpdate(snapshot=new_snapshot),))
19871991

0 commit comments

Comments
 (0)