Conversation
Fix pyright errors in 25 test files in tests/test_observable/: - Add 'from typing import NoReturn' import - Annotate '_raise' functions with 'ex: Exception -> NoReturn' signature - Fix callsites passing str to '_raise()' to wrap in Exception() - Fix subscribe functions returning 'lambda: None' to return Disposable() - Fix 'return dispose' to 'return Disposable(dispose)' - Fix 'o.on_error(str)' calls to wrap strings in Exception() - Fix 'do_action(on_next=action)' with zero-param action to accept one param - Remove non-None return values from 'finally_action' callbacks These changes allow tests/test_observable/ to eventually be removed from the pyright exclude list in pyproject.toml. Co-authored-by: Copilot <[email protected]>
Pre-commit hook failures from PR #785: - Reorder `from typing import NoReturn` after `from datetime` in 3 files - Wrap two long lines exceeding 88 chars in test_fromiterable.py and test_minby.py Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
dbrattli
approved these changes
May 1, 2026
4 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
Fixes pyright strict-mode type errors in 25 test files in
tests/test_observable/, continuing the cleanup started in batches 1 (#780) and 2 (#782).Changes
25 files modified across these error patterns:
_raiseannotation — Addedfrom typing import NoReturnand annotateddef _raise(ex: Exception) -> NoReturn:(orex: strwhere the function wraps strings inRxException). UsingNoReturnis required because_raiseis used in lambda contexts where the lambda's return type matters (e.g. key selectors, comparers).Callsite string-to-Exception wrapping — Changed
_raise(ex)/_raise("ex")to_raise(Exception(ex))/_raise(Exception("ex"))in files whereexis a plain string. Assertions remain correct becauseNotification.__eq__uses string comparison (str(Exception("ex")) == "ex").Subscribe return type — Changed
return lambda: Nonetoreturn Disposable()in subscribe functions passed toreactivex.create(). TheSubscription[T]type requiresDisposableBase, notCallable[[], None]. Addedfrom reactivex.disposable import Disposablewhere needed.Dispose wrapper — Changed
return disposetoreturn Disposable(dispose)intest_create.pywheredisposeis aCallable[[], None].on_errorstring args — Changedo.on_error("ex")etc. too.on_error(Exception("ex"))sinceObserver.on_errorexpectsException.finally_actioncallback — Removedreturnstatements fromaction()functions intest_finally.py.Action = Callable[[], None]must return None.do_action(on_next=...)parameter — Changeddef action():todef action(_: object) -> None:intest_merge.pysinceOnNext[T] = Callable[[T], None]requires one parameter.Files changed
test_bufferwithcount,test_create,test_debounce,test_defer,test_delay,test_delaywithmapper,test_distinct,test_distinctuntilchanged,test_expand,test_finally,test_firstordefault,test_fromcallback,test_fromiterable,test_generatewithrelativetime,test_last,test_merge,test_minby,test_publish,test_returnvalue,test_single,test_singleordefault,test_takeuntilwithtime,test_timeout,test_timeoutwithmapper,test_usingNext step
After all files in
tests/test_observable/pass pyright checks, a maintainer can removetests/test_observablefrom the[tool.pyright] excludelist inpyproject.toml(protected file — requires manual edit).CI will validate via
uv run pytestanduv run pyright.Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
astral.shSee Network Configuration for more information.
Note
🔒 Integrity filter blocked 72 items
The following items were blocked because they don't meet the GitHub integrity level.
list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".To allow these resources, lower
min-integrityin your GitHub frontmatter: