66from effect .testing import SequenceDispatcher
77
88
9+ def _disp (dispatcher ):
10+ return ComposedDispatcher ([dispatcher , base_dispatcher ])
11+
912def test_fold_effect ():
1013 """Behaves like foldM."""
1114 effs = [Effect ('a' ), Effect ('b' ), Effect ('c' )]
@@ -18,9 +21,7 @@ def test_fold_effect():
1821 eff = fold_effect (operator .add , 'Nil' , effs )
1922
2023 with dispatcher .consume ():
21- result = sync_perform (
22- ComposedDispatcher ([dispatcher , base_dispatcher ]),
23- eff )
24+ result = sync_perform (_disp (dispatcher ), eff )
2425 assert result == 'NilEiBeeCee'
2526
2627
@@ -34,6 +35,7 @@ def test_fold_effect_empty():
3435
3536
3637def test_sequence ():
38+ """Collects each Effectful result into a list."""
3739 effs = [Effect ('a' ), Effect ('b' ), Effect ('c' )]
3840 dispatcher = SequenceDispatcher ([
3941 ('a' , lambda i : 'Ei' ),
@@ -44,5 +46,10 @@ def test_sequence():
4446
4547 print "what the heck is sequence returning?" , eff
4648 with dispatcher .consume ():
47- result = sync_perform (dispatcher , eff )
49+ result = sync_perform (_disp ( dispatcher ) , eff )
4850 assert result == ['Ei' , 'Bee' , 'Cee' ]
51+
52+
53+ def test_sequence_empty ():
54+ """Returns an empty list when there are no Effects."""
55+ assert sync_perform (base_dispatcher , sequence ([])) == []
0 commit comments