You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(tests): replace type:ignore comments with proper type annotations
Builds on PR #782 to replace the `# type: ignore` suppressions with
real type annotations and structural fixes:
- Use `isinstance(value, OnError|OnNext)` to narrow `Recorded.value` instead
of `# type: ignore[union-attr]` (test_average, test_elementat, test_reduce,
test_toiterable).
- Properly annotate test-local `subscribe` functions with
`ObserverBase[T] / SchedulerBase | None / DisposableBase` and return
`Disposable()` so `reactivex.create(...)` accepts them without
`# type: ignore[misc]/[arg-type]` (test_concat, test_observeon, test_map,
test_skipuntil, test_while_do).
- Type `xs` as `list[ColdObservable[int] | None]` in test_defer instead of
bare `[None]`, and add `assert xs[0] is not None` narrowing.
- Annotate `_raise` as `NoReturn` in test_map, test_retry, test_generate so
the surrounding code type-checks without trailing dummy returns.
- Use a typed module-level seed in test_generate to widen `Literal[0]` to
`int` so `lambda x: x + 1` matches `Mapper[int, int]`.
- `cast(Observable[int], s)` in test_tofuture instead of `# type: ignore`.
Also widens two clearly-incorrect public type signatures (the implementation
already supports the wider input):
- `delay()` and `delay_()` now accept `AbsoluteOrRelativeTime` instead of
only `RelativeTime`. The implementation already branches on
`isinstance(duetime, datetime)`, so this just makes the signature match
reality and removes 5 `# type: ignore[arg-type]` in test_delay.
- `from_callback()` now returns `Callable[..., Observable[Any]]` instead of
`Callable[[], Observable[Any]]`. The inner `function(*args)` already
accepts arbitrary args, so this matches reality and removes 2
`# type: ignore[call-arg]` in test_fromcallback.
Only `test_of.py:51` keeps a `# type: ignore[call-arg]` — it's in a
test that never runs (typo `teest_` in the name) and intentionally calls
`reactivex.of()` with a kwarg that doesn't exist; fixing it is out of
scope.
Pyright strict: 0 errors. All 1494 tests pass.
0 commit comments