-
Notifications
You must be signed in to change notification settings - Fork 152
Description
🧩 Intermediate Contributors
This issue is intended for contributors who already have some familiarity with the
Hiero Python SDK codebase and contribution workflow.
You should feel comfortable:
- navigating existing source code and examples
- understanding SDK concepts without step-by-step guidance
- following the standard PR workflow without additional onboarding
If this is your very first contribution to the project, we recommend starting with a few
Good First Issues before working on this one.
🐞 Problem Description
Describe the problem here.
we have some tests: tests/unit/hbar_test.py
for
src/hiero_sdk_python/hbar.py
You can see we reach very high coverage, but some areas remain untested
https://app.codecov.io/gh/hiero-ledger/hiero-sdk-python/blob/main/src%2Fhiero_sdk_python%2Fhbar.py
💡 Expected Solution
Improve the test coverage for hbar.py, following https://app.codecov.io/gh/hiero-ledger/hiero-sdk-python/blob/main/src%2Fhiero_sdk_python%2Fhbar.py red suggestions
🧠 Implementation Notes
Edit
tests/unit/hbar_test.py
Possibly Missing Coverage Ideas:
(please do not attempt to do all! a general improvement is good
- from_tinybars() input validation
- Non-int inputs (e.g., float, Decimal, str)
- Fractional tinybar rejection via non-TINYBAR units
e.g., Hbar(0.000000001, unit=HBAR)
String representation methods - str formatting (8 decimal places, negatives)
- repr output
- Hash behavior
- Consistency for equal values
- Set/dict compatibility
- Comparison operators with non-Hbar types
- <, >, <=, >= should raise TypeError
- from_string() default unit override
- When no unit is provided in the string
- Regex edge cases in from_string()
- Spacing, leading zeros, tabs, multiple spaces
- Precision boundary checks
- Reject values smaller than 1 tinybar
- MAX/MIN boundary behavior
- Comparisons around defined limits
✅ Acceptance Criteria
To merge this issue, the pull request must:
- Fully address the problem described above
- Follow existing project conventions and patterns
- Include tests or example updates where appropriate
- Pass all CI checks
- Include a valid changelog entry
- Use DCO and GPG-signed commits