Skip to content

Commit 3efe53c

Browse files
committed
Fixed comments
1 parent 84d0971 commit 3efe53c

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

tests/table/test_init.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
_match_deletes_to_data_file,
5050
)
5151
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 MAIN_BRANCH, SnapshotRef, SnapshotRefType
5353
from pyiceberg.table.snapshots import (
5454
MetadataLogEntry,
5555
Operation,
@@ -982,34 +982,31 @@ def test_assert_table_uuid(table_v2: Table) -> None:
982982

983983
def test_assert_ref_snapshot_id(table_v2: Table) -> None:
984984
base_metadata = table_v2.metadata
985-
AssertRefSnapshotId(ref="main", snapshot_id=base_metadata.current_snapshot_id).validate(base_metadata)
985+
AssertRefSnapshotId(ref=MAIN_BRANCH, snapshot_id=base_metadata.current_snapshot_id).validate(base_metadata)
986986

987987
with pytest.raises(CommitFailedException, match="Requirement failed: current table metadata is missing"):
988-
AssertRefSnapshotId(ref="main", snapshot_id=1).validate(None)
988+
AssertRefSnapshotId(ref=MAIN_BRANCH, snapshot_id=1).validate(None)
989989

990990
with pytest.raises(
991991
CommitFailedException,
992-
match="Requirement failed: branch main was created concurrently",
992+
match=f"Requirement failed: branch {MAIN_BRANCH} was created concurrently",
993993
):
994-
AssertRefSnapshotId(ref="main", snapshot_id=None).validate(base_metadata)
994+
AssertRefSnapshotId(ref=MAIN_BRANCH, snapshot_id=None).validate(base_metadata)
995995

996996
with pytest.raises(
997997
CommitFailedException,
998-
match="Requirement failed: branch main has changed: expected id 1, found 3055729675574597004",
998+
match=f"Requirement failed: branch {MAIN_BRANCH} has changed: expected id 1, found 3055729675574597004",
999999
):
1000-
AssertRefSnapshotId(ref="main", snapshot_id=1).validate(base_metadata)
1000+
AssertRefSnapshotId(ref=MAIN_BRANCH, snapshot_id=1).validate(base_metadata)
10011001

1002-
with pytest.raises(
1003-
CommitFailedException,
1004-
match="Requirement failed: branch or tag not_exist_branch is missing, expected 1",
1005-
):
1006-
AssertRefSnapshotId(ref="not_exist_branch", snapshot_id=1).validate(base_metadata)
1002+
non_existing_ref = "not_exist_branch_or_tag"
1003+
assert table_v2.refs().get("not_exist_branch_or_tag") is None
10071004

10081005
with pytest.raises(
10091006
CommitFailedException,
1010-
match="Requirement failed: branch or tag not_exist_tag is missing, expected 1",
1007+
match=f"Requirement failed: branch or tag {non_existing_ref} is missing, expected 1",
10111008
):
1012-
AssertRefSnapshotId(ref="not_exist_tag", snapshot_id=1).validate(base_metadata)
1009+
AssertRefSnapshotId(ref=non_existing_ref, snapshot_id=1).validate(base_metadata)
10131010

10141011
# existing Tag in metadata: test
10151012
ref_tag = table_v2.refs().get("test")

0 commit comments

Comments
 (0)