Skip to content
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

Update outdated and broken example for AsyncTestSubject #46

Merged
merged 2 commits into from
Feb 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 14 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,23 +372,20 @@ def event_loop():

@pytest.mark.asyncio
async def test_delay_done():
xs = AsyncSubject() # Test stream

async def mapper(value):
return value * 10

ys = delay(0.5, xs)
lis = AsyncTestObserver() # Test AsyncAnonymousObserver
sub = await subscribe_async(ys, lis)
await xs.asend_later(0, 10)
await xs.asend_later(1, 20)
await xs.aclose_later(1)
await sub

assert lis.values == [
(0.5, OnNext(10)),
(1.5, OnNext(20)),
(2.5, OnCompleted)
xs = AsyncTestSubject() # Test stream

ys = pipe(xs, rx.delay(1.0))
obv = AsyncTestObserver() # Test AsyncAnonymousObserver
async with await ys.subscribe_async(obv):
await xs.asend_later(0, 10)
await xs.asend_later(1.0, 20)
await xs.aclose_later(1.0)
await obv

assert obv.values == [
(ca(1), OnNext(10)),
(ca(2), OnNext(20)),
(ca(3), OnCompleted()),
]
```

Expand Down
Loading