-
Notifications
You must be signed in to change notification settings - Fork 4
test: proto pr test #209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: proto pr test #209
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -9,7 +9,7 @@ | |||||||||||||||||||||||||
| from hiero_sdk_python.account.account_id import AccountId | ||||||||||||||||||||||||||
| from hiero_sdk_python.crypto.public_key import PublicKey | ||||||||||||||||||||||||||
| from hiero_sdk_python.Duration import Duration | ||||||||||||||||||||||||||
| from hiero_sdk_python.hapi.services.basic_types_pb2 import StakingInfo | ||||||||||||||||||||||||||
| from hiero_sdk_python.staking_info import StakingInfo | ||||||||||||||||||||||||||
| from hiero_sdk_python.hapi.services.crypto_get_info_pb2 import CryptoGetInfoResponse | ||||||||||||||||||||||||||
| from hiero_sdk_python.hbar import Hbar | ||||||||||||||||||||||||||
| from hiero_sdk_python.timestamp import Timestamp | ||||||||||||||||||||||||||
|
|
@@ -56,9 +56,8 @@ class AccountInfo: | |||||||||||||||||||||||||
| account_memo: Optional[str] = None | ||||||||||||||||||||||||||
| owned_nfts: Optional[int] = None | ||||||||||||||||||||||||||
| max_automatic_token_associations: Optional[int] = None | ||||||||||||||||||||||||||
| staked_account_id: Optional[AccountId] = None | ||||||||||||||||||||||||||
| staked_node_id: Optional[int] = None | ||||||||||||||||||||||||||
| decline_staking_reward: Optional[bool] = None | ||||||||||||||||||||||||||
| staking_info: Optional[StakingInfo] = None | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| @classmethod | ||||||||||||||||||||||||||
| def _from_proto(cls, proto: CryptoGetInfoResponse.AccountInfo) -> "AccountInfo": | ||||||||||||||||||||||||||
|
|
@@ -100,20 +99,14 @@ def _from_proto(cls, proto: CryptoGetInfoResponse.AccountInfo) -> "AccountInfo": | |||||||||||||||||||||||||
| account_memo=proto.memo, | ||||||||||||||||||||||||||
| owned_nfts=proto.ownedNfts, | ||||||||||||||||||||||||||
| max_automatic_token_associations=proto.max_automatic_token_associations, | ||||||||||||||||||||||||||
| staking_info=( | ||||||||||||||||||||||||||
| StakingInfo._from_proto(proto.staking_info) | ||||||||||||||||||||||||||
| if proto.HasField("staking_info") | ||||||||||||||||||||||||||
| else None | ||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| staking_info = proto.staking_info if proto.HasField('staking_info') else None | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| if staking_info: | ||||||||||||||||||||||||||
| account_info.staked_account_id = ( | ||||||||||||||||||||||||||
| AccountId._from_proto(staking_info.staked_account_id) | ||||||||||||||||||||||||||
| if staking_info.HasField('staked_account_id') else None | ||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||
| account_info.staked_node_id = ( | ||||||||||||||||||||||||||
| staking_info.staked_node_id | ||||||||||||||||||||||||||
| if staking_info.HasField('staked_node_id') else None | ||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||
| account_info.decline_staking_reward = staking_info.decline_reward | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| return account_info | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
@@ -147,11 +140,11 @@ def _to_proto(self) -> CryptoGetInfoResponse.AccountInfo: | |||||||||||||||||||||||||
| memo=self.account_memo, | ||||||||||||||||||||||||||
| ownedNfts=self.owned_nfts, | ||||||||||||||||||||||||||
| max_automatic_token_associations=self.max_automatic_token_associations, | ||||||||||||||||||||||||||
| staking_info=StakingInfo( | ||||||||||||||||||||||||||
| staked_account_id=self.staked_account_id._to_proto() if self.staked_account_id else None, | ||||||||||||||||||||||||||
| staked_node_id=self.staked_node_id if self.staked_node_id else None, | ||||||||||||||||||||||||||
| decline_reward=self.decline_staking_reward | ||||||||||||||||||||||||||
| ), | ||||||||||||||||||||||||||
| staking_info=( | ||||||||||||||||||||||||||
| self.staking_info._to_proto() | ||||||||||||||||||||||||||
| if self.staking_info is not None | ||||||||||||||||||||||||||
| else None | ||||||||||||||||||||||||||
| ), | ||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||
|
Comment on lines
+143
to
148
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Inconsistent indentation in Line 147 uses 6-space indentation which breaks consistency with the rest of the method. 🔧 Proposed fix staking_info=(
self.staking_info._to_proto()
if self.staking_info is not None
else None
- ),
+ ),
)📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| def __str__(self) -> str: | ||||||||||||||||||||||||||
|
|
@@ -166,8 +159,7 @@ def __str__(self) -> str: | |||||||||||||||||||||||||
| (self.account_memo, "Memo"), | ||||||||||||||||||||||||||
| (self.owned_nfts, "Owned NFTs"), | ||||||||||||||||||||||||||
| (self.max_automatic_token_associations, "Max Automatic Token Associations"), | ||||||||||||||||||||||||||
| (self.staked_account_id, "Staked Account ID"), | ||||||||||||||||||||||||||
| (self.staked_node_id, "Staked Node ID"), | ||||||||||||||||||||||||||
| (self.staking_info, "Staked Info"), | ||||||||||||||||||||||||||
| (self.proxy_received, "Proxy Received"), | ||||||||||||||||||||||||||
| (self.expiration_time, "Expiration Time"), | ||||||||||||||||||||||||||
| (self.auto_renew_period, "Auto Renew Period"), | ||||||||||||||||||||||||||
|
|
@@ -182,9 +174,6 @@ def __str__(self) -> str: | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| if self.receiver_signature_required is not None: | ||||||||||||||||||||||||||
| lines.append(f"Receiver Signature Required: {self.receiver_signature_required}") | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| if self.decline_staking_reward is not None: | ||||||||||||||||||||||||||
| lines.append(f"Decline Staking Reward: {self.decline_staking_reward}") | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| if self.token_relationships: | ||||||||||||||||||||||||||
| lines.append(f"Token Relationships: {len(self.token_relationships)}") | ||||||||||||||||||||||||||
|
|
@@ -202,7 +191,6 @@ def __repr__(self) -> str: | |||||||||||||||||||||||||
| f"receiver_signature_required={self.receiver_signature_required!r}, " | ||||||||||||||||||||||||||
| f"owned_nfts={self.owned_nfts!r}, " | ||||||||||||||||||||||||||
| f"account_memo={self.account_memo!r}, " | ||||||||||||||||||||||||||
| f"staked_node_id={self.staked_node_id!r}, " | ||||||||||||||||||||||||||
| f"staked_account_id={self.staked_account_id!r}" | ||||||||||||||||||||||||||
| f"staked_info={self.staking_info!r}, " | ||||||||||||||||||||||||||
| f")" | ||||||||||||||||||||||||||
|
Comment on lines
+194
to
195
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inconsistent field name in The field is named 🔧 Proposed fix- f"staked_info={self.staking_info!r}, "
+ f"staking_info={self.staking_info!r}, "📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -9,6 +9,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from hiero_sdk_python.tokens.token_relationship import TokenRelationship | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from hiero_sdk_python.tokens.token_id import TokenId | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from hiero_sdk_python.hapi.services.crypto_get_info_pb2 import CryptoGetInfoResponse | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from hiero_sdk_python.staking_info import StakingInfo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pytestmark = pytest.mark.unit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -28,6 +29,8 @@ def account_info(): | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| token_relationships=[], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| account_memo="Test account memo", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| owned_nfts=5, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| max_automatic_token_associations=10, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| staking_info=None | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -47,6 +50,8 @@ def proto_account_info(): | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tokenRelationships=[], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| memo="Test account memo", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ownedNfts=5, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| max_automatic_token_associations=10, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| staking_info=None | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return proto | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -65,6 +70,32 @@ def test_account_info_initialization(account_info): | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert account_info.token_relationships == [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert account_info.account_memo == "Test account memo" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert account_info.owned_nfts == 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert account_info.max_automatic_token_associations == 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert account_info.staking_info is None | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def test_from_proto_with_staking_info(): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Test the from_proto method of the AccountInfo class with staking info""" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public_key = PrivateKey.generate_ed25519().public_key() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| staking_info={ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "decline_reward": True, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "staked_node_id": 3, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "staked_account_id": None | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| proto = CryptoGetInfoResponse.AccountInfo( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| accountID=AccountId(0, 0, 100)._to_proto(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| key=public_key._to_proto(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| balance=5000000, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| account_info = AccountInfo._from_proto(proto) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert account_info.staking_info is not None | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert account_info.staking_info.decline_reward is True | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert account_info.staking_info.staked_node_id == 3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+76
to
+98
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Test is broken: The test creates a Static analysis also flagged the unused variable on line 80. 🐛 Proposed fix - set staking_info on the proto def test_from_proto_with_staking_info():
"""Test the from_proto method of the AccountInfo class with staking info"""
public_key = PrivateKey.generate_ed25519().public_key()
- staking_info={
- "decline_reward": True,
- "staked_node_id": 3,
- "staked_account_id": None
- }
+ # Create StakingInfo and convert to proto
+ staking_info = StakingInfo(
+ decline_reward=True,
+ staked_node_id=3,
+ staked_account_id=None
+ )
proto = CryptoGetInfoResponse.AccountInfo(
accountID=AccountId(0, 0, 100)._to_proto(),
key=public_key._to_proto(),
balance=5000000,
-
-
+ staking_info=staking_info._to_proto(),
)
account_info = AccountInfo._from_proto(proto)
assert account_info.staking_info is not None
assert account_info.staking_info.decline_reward is True
assert account_info.staking_info.staked_node_id == 3📝 Committable suggestion
Suggested change
🧰 Tools🪛 Ruff (0.14.14)[error] 80-80: Local variable Remove assignment to unused variable (F841) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def test_account_info_default_initialization(): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -82,7 +113,25 @@ def test_account_info_default_initialization(): | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert account_info.token_relationships == [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert account_info.account_memo is None | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert account_info.owned_nfts is None | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert account_info.max_automatic_token_associations is None | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert account_info.staking_info is None | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def test_staking_info_persistence(account_info): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Ensure staking info is preserved through proto conversion""" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| account_info.staking_info = StakingInfo( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| decline_reward=True, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| staked_node_id=5, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| staked_account_id=None | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| proto = account_info._to_proto() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| converted_info = AccountInfo._from_proto(proto) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert converted_info.staking_info is not None | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert converted_info.staking_info.decline_reward is True | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert converted_info.staking_info.staked_node_id == 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert converted_info.staking_info.staked_account_id is None | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def test_from_proto(proto_account_info): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Test the from_proto method of the AccountInfo class""" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -100,6 +149,8 @@ def test_from_proto(proto_account_info): | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert account_info.token_relationships == [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert account_info.account_memo == "Test account memo" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert account_info.owned_nfts == 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert account_info.max_automatic_token_associations == 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert account_info.staking_info == None | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use Per PEP 8, comparisons to singletons like 🔧 Proposed fix- assert account_info.staking_info == None
+ assert account_info.staking_info is None📝 Committable suggestion
Suggested change
🧰 Tools🪛 Ruff (0.14.14)[error] 153-153: Comparison to Replace with (E711) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def test_from_proto_with_token_relationships(): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -141,6 +192,11 @@ def test_to_proto(account_info): | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert proto.tokenRelationships == [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert proto.memo == "Test account memo" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert proto.ownedNfts == 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert proto.max_automatic_token_associations == 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert not proto.HasField("staking_info") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def test_to_proto_with_none_values(): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -192,6 +248,7 @@ def test_proto_conversion(account_info): | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert converted_account_info.account_memo == account_info.account_memo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert converted_account_info.owned_nfts == account_info.owned_nfts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert converted_account_info.staking_info == account_info.staking_info | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def test_str_and_repr(account_info): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.