-
Notifications
You must be signed in to change notification settings - Fork 108
test: add unit test for subscription_handle #1028
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
Merged
+34
−1
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e11bfd1
test: add subscription_handle unit tests and CI workflow; docs: add t…
Giannis-dot 92ab148
All maintainer feedback addressed
Giannis-dot f2634db
final fix
Giannis-dot 1201a3e
Merge branch 'main' into Giannis-fix
Giannis-dot 764bf1f
That is the correct commit. i made a mistake before
Giannis-dot 5fb50a8
docs: remove out-of-scope test documentation from CONTRIBUTING.md
Giannis-dot 0a7a064
test: remove unnecessary shims directory
Giannis-dot a851971
chore: remove unintended mypy_minimal.ini file
Giannis-dot eb1a976
Merge branch 'main' into Giannis-fix
Giannis-dot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| from unittest.mock import Mock | ||
|
|
||
| from hiero_sdk_python.utils.subscription_handle import SubscriptionHandle | ||
|
|
||
|
|
||
| def test_not_cancelled_by_default(): | ||
| handle = SubscriptionHandle() | ||
| assert not handle.is_cancelled() | ||
|
|
||
|
|
||
| def test_cancel_marks_as_cancelled(): | ||
| handle = SubscriptionHandle() | ||
| handle.cancel() | ||
| assert handle.is_cancelled() | ||
|
|
||
|
|
||
| def test_set_thread_and_join_calls_thread_join_with_timeout(): | ||
| handle = SubscriptionHandle() | ||
| mock_thread = Mock() | ||
| handle.set_thread(mock_thread) | ||
| handle.join(timeout=0.25) | ||
| mock_thread.join.assert_called_once_with(0.25) | ||
|
|
||
|
|
||
| def test_join_without_thread_raises_nothing(): | ||
| handle = SubscriptionHandle() | ||
| # should not raise | ||
| handle.join() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| [mypy] | ||
| ignore_missing_imports = True | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.