Skip to content

Commit c26d865

Browse files
committed
Fix mypy errors in test_commit_retry
Use Operation enum instead of string literals for producer construction. Use .value for IsolationLevel string comparison to avoid unreachable statement warning. Signed-off-by: Sotaro Hikita <bering1814@gmail.com>
1 parent b81a1c1 commit c26d865

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

tests/table/test_commit_retry.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
from pyiceberg.exceptions import CommitFailedException, ValidationException
2323
from pyiceberg.schema import Schema
2424
from pyiceberg.table import TableProperties, Transaction
25-
from pyiceberg.table.snapshots import IsolationLevel
25+
from pyiceberg.table.snapshots import IsolationLevel, Operation
2626
from pyiceberg.types import LongType, NestedField, StringType
2727

2828

2929
def test_isolation_level_enum() -> None:
30-
assert IsolationLevel.SERIALIZABLE == "serializable"
31-
assert IsolationLevel.SNAPSHOT == "snapshot"
32-
assert IsolationLevel("serializable") == IsolationLevel.SERIALIZABLE
33-
assert IsolationLevel("snapshot") == IsolationLevel.SNAPSHOT
30+
assert IsolationLevel.SERIALIZABLE.value == "serializable"
31+
assert IsolationLevel.SNAPSHOT.value == "snapshot"
32+
assert IsolationLevel("serializable") is IsolationLevel.SERIALIZABLE
33+
assert IsolationLevel("snapshot") is IsolationLevel.SNAPSHOT
3434

3535

3636
def test_commit_retry_table_properties() -> None:
@@ -141,7 +141,7 @@ def test_refresh_for_retry_resets_producer_state(catalog: Catalog) -> None:
141141

142142
tx = Transaction(table, autocommit=False)
143143
producer = _FastAppendFiles(
144-
operation="append",
144+
operation=Operation.APPEND,
145145
transaction=tx,
146146
io=table.io,
147147
)
@@ -278,7 +278,7 @@ def test_delete_files_refresh_clears_compute_deletes_cache(catalog: Catalog) ->
278278

279279
tx = Transaction(table, autocommit=False)
280280
producer = _DeleteFiles(
281-
operation="delete",
281+
operation=Operation.DELETE,
282282
transaction=tx,
283283
io=table.io,
284284
)

0 commit comments

Comments
 (0)