Skip to content

Commit 322b4dc

Browse files
Michał KudelaAndrzej Lisak
authored andcommitted
Fix Operation class typing and safety for transaction and rc_cost
1 parent 7936381 commit 322b4dc

File tree

1 file changed

+7
-5
lines changed
  • tests/python/hive-local-tools/hive_local_tools/functional/python/operation

1 file changed

+7
-5
lines changed

tests/python/hive-local-tools/hive_local_tools/functional/python/operation/__init__.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,23 @@
3636
class Operation:
3737
_node: tt.InitNode
3838
_wallet: tt.Wallet
39-
_rc_cost: int = field(init=False, default=None)
40-
_transaction: dict = field(init=False, default=None)
39+
_rc_cost: int | None = field(init=False, default=None)
40+
_transaction: dict[str, Any] | None = field(init=False, default=None)
4141

4242
@property
4343
def rc_cost(self) -> int:
44+
assert self._rc_cost is not None
4445
return self._rc_cost
4546

4647
@property
47-
def transaction(self) -> dict:
48+
def transaction(self) -> dict[str, Any]:
49+
assert self._transaction is not None
4850
return self._transaction
4951

5052
def assert_minimal_operation_rc_cost(self, minimal_cost: int | None = None) -> None:
5153
if minimal_cost:
52-
assert self._rc_cost >= minimal_cost, f"RC cost is less than or {minimal_cost}."
53-
assert self._rc_cost > 0, "RC cost is less than or equal to zero."
54+
assert self.rc_cost >= minimal_cost, f"RC cost is less than or {minimal_cost}."
55+
assert self.rc_cost > 0, "RC cost is less than or equal to zero."
5456

5557

5658
ApiAccountItem = AccountItemFundament

0 commit comments

Comments
 (0)