|
49 | 49 | _match_deletes_to_data_file, |
50 | 50 | ) |
51 | 51 | from pyiceberg.table.metadata import INITIAL_SEQUENCE_NUMBER, TableMetadataUtil, TableMetadataV2, _generate_snapshot_id |
52 | | -from pyiceberg.table.refs import SnapshotRef, SnapshotRefType |
| 52 | +from pyiceberg.table.refs import SnapshotRef |
53 | 53 | from pyiceberg.table.snapshots import ( |
54 | 54 | MetadataLogEntry, |
55 | 55 | Operation, |
@@ -982,43 +982,41 @@ def test_assert_table_uuid(table_v2: Table) -> None: |
982 | 982 |
|
983 | 983 | def test_assert_ref_snapshot_id(table_v2: Table) -> None: |
984 | 984 | base_metadata = table_v2.metadata |
985 | | - AssertRefSnapshotId(ref="main", snapshot_id=base_metadata.current_snapshot_id, ref_type=SnapshotRefType.BRANCH).validate( |
986 | | - base_metadata |
987 | | - ) |
| 985 | + AssertRefSnapshotId(ref="main", snapshot_id=base_metadata.current_snapshot_id).validate(base_metadata) |
988 | 986 |
|
989 | 987 | with pytest.raises(CommitFailedException, match="Requirement failed: current table metadata is missing"): |
990 | | - AssertRefSnapshotId(ref="main", snapshot_id=1, ref_type=SnapshotRefType.BRANCH).validate(None) |
| 988 | + AssertRefSnapshotId(ref="main", snapshot_id=1).validate(None) |
991 | 989 |
|
992 | 990 | with pytest.raises( |
993 | 991 | CommitFailedException, |
994 | 992 | match="Requirement failed: branch main was created concurrently", |
995 | 993 | ): |
996 | | - AssertRefSnapshotId(ref="main", snapshot_id=None, ref_type=SnapshotRefType.BRANCH).validate(base_metadata) |
| 994 | + AssertRefSnapshotId(ref="main", snapshot_id=None).validate(base_metadata) |
997 | 995 |
|
998 | 996 | with pytest.raises( |
999 | 997 | CommitFailedException, |
1000 | 998 | match="Requirement failed: branch main has changed: expected id 1, found 3055729675574597004", |
1001 | 999 | ): |
1002 | | - AssertRefSnapshotId(ref="main", snapshot_id=1, ref_type=SnapshotRefType.BRANCH).validate(base_metadata) |
| 1000 | + AssertRefSnapshotId(ref="main", snapshot_id=1).validate(base_metadata) |
1003 | 1001 |
|
1004 | 1002 | with pytest.raises( |
1005 | 1003 | CommitFailedException, |
1006 | 1004 | match="Requirement failed: branch or tag not_exist_branch is missing, expected 1", |
1007 | 1005 | ): |
1008 | | - AssertRefSnapshotId(ref="not_exist_branch", snapshot_id=1, ref_type=SnapshotRefType.BRANCH).validate(base_metadata) |
| 1006 | + AssertRefSnapshotId(ref="not_exist_branch", snapshot_id=1).validate(base_metadata) |
1009 | 1007 |
|
1010 | 1008 | with pytest.raises( |
1011 | 1009 | CommitFailedException, |
1012 | 1010 | match="Requirement failed: branch or tag not_exist_tag is missing, expected 1", |
1013 | 1011 | ): |
1014 | | - AssertRefSnapshotId(ref="not_exist_tag", snapshot_id=1, ref_type=SnapshotRefType.TAG).validate(base_metadata) |
| 1012 | + AssertRefSnapshotId(ref="not_exist_tag", snapshot_id=1).validate(base_metadata) |
1015 | 1013 |
|
1016 | 1014 | # existing Tag in metadata: test |
1017 | 1015 | with pytest.raises( |
1018 | 1016 | CommitFailedException, |
1019 | | - match="Requirement failed: tag test can't be changed to type branch", |
| 1017 | + match="Requirement failed: TAG test can't be updated once created", |
1020 | 1018 | ): |
1021 | | - AssertRefSnapshotId(ref="test", snapshot_id=3051729675574597004, ref_type=SnapshotRefType.BRANCH).validate(base_metadata) |
| 1019 | + AssertRefSnapshotId(ref="test", snapshot_id=3051729675574597004).validate(base_metadata) |
1022 | 1020 |
|
1023 | 1021 |
|
1024 | 1022 | def test_assert_last_assigned_field_id(table_v2: Table) -> None: |
|
0 commit comments