Skip to content

Commit 71fb692

Browse files
committed
add a noop helper to effect.testing for use in SequenceDispatchers
1 parent a9b2ed2 commit 71fb692

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

effect/testing.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@
2121
__all__ = [
2222
'perform_sequence',
2323
'SequenceDispatcher',
24-
'EQDispatcher',
25-
'EQFDispatcher',
24+
'noop',
2625
'resolve_effect',
2726
'fail_effect',
27+
'EQDispatcher',
28+
'EQFDispatcher',
2829
'Stub',
2930
'ESConstant', 'ESError', 'ESFunc',
3031
'resolve_stubs',
@@ -453,3 +454,20 @@ def consume(self):
453454
raise AssertionError(
454455
"Not all intents were performed: {0}".format(
455456
[x[0] for x in self.sequence]))
457+
458+
459+
def noop(intent):
460+
"""
461+
462+
Return None. This is just a handy way to make your intent sequences (as
463+
used by :func:`perform_sequence`) more concise when the effects you're
464+
expecting in a test don't return a result (and are instead only performed
465+
for their side-effects)::
466+
467+
seq = [
468+
(Prompt('Enter your name: '), lambda i: 'Chris')
469+
(Greet('Chris'), noop),
470+
]
471+
472+
"""
473+
return None

0 commit comments

Comments
 (0)