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

Enhancement: marbles syntax + testing functions #299

Merged
merged 17 commits into from
Feb 6, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions examples/marbles/frommarbles_error.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import time

import rx
from rx import concurrency as ccy
from rx.testing import marbles
Expand All @@ -14,3 +16,5 @@
on_completed=lambda: print('good job!'),
scheduler=ccy.timeout_scheduler,
)

time.sleep(3)
4 changes: 4 additions & 0 deletions examples/marbles/frommarbles_flatmap.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import time

from rx import operators as ops
from rx import concurrency as ccy
from rx.testing.marbles import from_marbles
Expand All @@ -20,3 +22,5 @@
on_completed=lambda: print('good job!'),
scheduler=ccy.timeout_scheduler,
)

time.sleep(3)
3 changes: 3 additions & 0 deletions examples/marbles/frommarbles_lookup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import time

import rx
from rx import concurrency as ccy
from rx.testing import marbles
Expand All @@ -16,3 +18,4 @@
scheduler=ccy.timeout_scheduler,
)

time.sleep(3)
8 changes: 6 additions & 2 deletions examples/marbles/frommarbles_merge.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import time

import rx
from rx import concurrency as ccy
from rx.testing import marbles

source0 = marbles.from_marbles('a-----d---1--------4-|', timespan=0.2)
source1 = marbles.from_marbles('--b-c-------2---3-| ', timespan=0.2)
source0 = marbles.from_marbles('a-----d---1--------4-|', timespan=0.1)
source1 = marbles.from_marbles('--b-c-------2---3-| ', timespan=0.1)

observable = rx.merge(source0, source1)

Expand All @@ -13,3 +15,5 @@
on_completed=lambda: print('good job!'),
scheduler=ccy.timeout_scheduler,
)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you considered using .run() instead? It's made for exactly this scenario. It will then return the last value emitted, and you can pipe to ops.to_iterable() to catch them all.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you're right, good idea !

time.sleep(3)