Skip to content

Commit 92ab148

Browse files
committed
All maintainer feedback addressed
Signed-off-by: Giannis <giannisgeorgiadiis@gmail.com>
1 parent e11bfd1 commit 92ab148

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
77
## [Unreleased]
88

99
### Added
10+
- Added unit tests for `SubscriptionHandle` class covering cancellation state, thread management, and join operations.
1011
- Modularized `transfer_transaction_fungible` example by introducing `account_balance_query()` & `transfer_transaction()`.Renamed `transfer_tokens()``main()`
1112
- Phase 2 of the inactivity-unassign bot:Automatically detects stale open pull requests (no commit activity for 21+ days), comments with a helpful InactivityBot message, closes the stale PR, and unassigns the contributor from the linked issue.
1213
- Added **str**() to CustomFixedFee and updated examples and tests accordingly.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from unittest.mock import Mock
2+
3+
from hiero_sdk_python.utils.subscription_handle import SubscriptionHandle
4+
5+
6+
def test_not_cancelled_by_default():
7+
handle = SubscriptionHandle()
8+
assert not handle.is_cancelled()
9+
10+
11+
def test_cancel_marks_as_cancelled():
12+
handle = SubscriptionHandle()
13+
handle.cancel()
14+
assert handle.is_cancelled()
15+
16+
17+
def test_set_thread_and_join_calls_thread_join_with_timeout():
18+
handle = SubscriptionHandle()
19+
mock_thread = Mock()
20+
handle.set_thread(mock_thread)
21+
handle.join(timeout=0.25)
22+
mock_thread.join.assert_called_once_with(0.25)
23+
24+
25+
def test_join_without_thread_raises_nothing():
26+
handle = SubscriptionHandle()
27+
# should not raise
28+
handle.join()

0 commit comments

Comments
 (0)