-
Notifications
You must be signed in to change notification settings - Fork 154
feat(account): add __str__ and __repr__ to AccountBalance #1122
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
Conversation
Signed-off-by: mukundkumarjha <[email protected]>
Signed-off-by: mukundkumarjha <[email protected]>
Signed-off-by: Mukund Jha <[email protected]>
Signed-off-by: mukundkumarjha <[email protected]>
Signed-off-by: mukundkumarjha <[email protected]>
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
WalkthroughAccountBalance gains str and repr methods for human- and developer-friendly string output. An example was simplified to print the AccountBalance directly (removed per-token print loop). Unit tests and CHANGELOG were added/updated to validate and document the new formatting. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
examples/query/account_balance_query_2.py(1 hunks)src/hiero_sdk_python/account/account_balance.py(1 hunks)tests/unit/test_account_balance.py(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
tests/unit/test_account_balance.py (3)
src/hiero_sdk_python/account/account_balance.py (1)
AccountBalance(14-82)src/hiero_sdk_python/hbar.py (1)
Hbar(18-174)src/hiero_sdk_python/tokens/token_id.py (1)
TokenId(21-180)
src/hiero_sdk_python/account/account_balance.py (2)
src/hiero_sdk_python/transaction/transaction_receipt.py (1)
token_id(56-68)src/hiero_sdk_python/utils/subscription_handle.py (1)
join(30-35)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (3)
src/hiero_sdk_python/account/account_balance.py (2)
56-68: LGTM!The
__str__implementation correctly formats the HBAR balance and conditionally includes token balances. The output format (e.g., "10.00000000 ℏ hbars") includes both the ℏ symbol and the word "hbars", which matches the examples in the linked issue requirements.
70-82: LGTM!The
__repr__implementation correctly provides a developer-friendly representation showing the key attributes. The use of!rformatting and the conditional handling of empty/non-empty token balances is appropriate.tests/unit/test_account_balance.py (1)
1-87: LGTM!The test suite comprehensively validates both
__str__and__repr__methods across multiple scenarios:
- HBAR-only balances
- Balances with tokens
- Empty token balances
The tests verify formatting details, conditional sections, and expected string representations. Well-structured and thorough.
|
Hi, this is WorkflowBot.
|
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #1122 +/- ##
==========================================
+ Coverage 91.08% 91.09% +0.01%
==========================================
Files 139 139
Lines 8423 8433 +10
==========================================
+ Hits 7672 7682 +10
Misses 751 751 🚀 New features to boost your workflow:
|
Signed-off-by: mukundkumarjha <[email protected]>
|
Hi, this is MergeConflictBot. Please resolve these conflicts locally and push the changes. To assist you, please read: Thank you for contributing! From the Hiero Python SDK Team |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
CHANGELOG.md (1)
43-43: Align CHANGELOG entry with established pattern for similar features.This entry is less detailed than comparable
__str__additions (lines 22, 33), which explicitly mention updated examples and tests. Per the AI summary, this PR updates examples and tests as well. Also missing is a reference to the related issue (#1097), which helps with traceability.🔎 Suggested CHANGELOG entry:
- Added __str__ and __repr__ to AccountBalance + Added __str__() and __repr__() to AccountBalance and updated examples and tests accordingly (#1097)
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
CHANGELOG.md(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (2)
CHANGELOG.md (2)
46-46: Changelog entry for account_create_transaction_with_fallback_alias refactor is well-documented.Clear description with specific function names and issue reference; this sets a good precedent that the AccountBalance entry could follow.
1-623: Actual code changes not provided for verification.Only CHANGELOG.md was included for review. The PR objectives specify detailed requirements for
AccountBalance.__str__()and__repr__()output formatting. To verify the implementation matches these specifications and that tests/examples are properly updated, please provide the code changes from:
src/hiero_sdk_python/account/account_balance.pytests/unit/test_account_balance.pyexamples/query/account_balance_query_2.py
Signed-off-by: mukundkumarjha <[email protected]>
Signed-off-by: mukundkumarjha <[email protected]>
Signed-off-by: mukundkumarjha <[email protected]>
…er#1122) Signed-off-by: mukundkumarjha <[email protected]> Signed-off-by: Mukund Jha <[email protected]> Signed-off-by: prajeeta pal <[email protected]>
Description:
Related issue(s):
Fixes #1097
Notes for reviewer:
Checklist
Summary by CodeRabbit
New Features
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.