1010from effect .testing import SequenceDispatcher
1111
1212
13- def _disp (dispatcher ):
13+ def _base_and (dispatcher ):
14+ """Compose base_dispatcher onto the given dispatcher."""
1415 return ComposedDispatcher ([dispatcher , base_dispatcher ])
1516
1617
1718def test_fold_effect ():
18- """Behaves like foldM."""
19+ """
20+ :func:`fold_effect` folds the given function over the results of the
21+ effects.
22+ """
1923 effs = [Effect ('a' ), Effect ('b' ), Effect ('c' )]
2024
2125 dispatcher = SequenceDispatcher ([
@@ -26,7 +30,7 @@ def test_fold_effect():
2630 eff = fold_effect (operator .add , 'Nil' , effs )
2731
2832 with dispatcher .consume ():
29- result = sync_perform (_disp (dispatcher ), eff )
33+ result = sync_perform (_base_and (dispatcher ), eff )
3034 assert result == 'NilEiBeeCee'
3135
3236
@@ -54,7 +58,7 @@ def test_fold_effect_errors():
5458
5559 with dispatcher .consume ():
5660 with raises (FoldError ) as excinfo :
57- sync_perform (_disp (dispatcher ), eff )
61+ sync_perform (_base_and (dispatcher ), eff )
5862 assert excinfo .value .accumulator == 'NilEi'
5963 assert excinfo .value .wrapped_exception [0 ] is ZeroDivisionError
6064 assert str (excinfo .value .wrapped_exception [1 ]) == 'foo'
0 commit comments