Skip to content

Commit 41c7238

Browse files
committed
add Values tests for composel, remove done TODO.
1 parent 9e582c8 commit 41c7238

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

unpythonic/seq.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ def lazy_begin0(*bodys):
9999
body()
100100
return out
101101

102-
# TODO: test multiple-return-values support in all function composition utilities (`curry`, `compose` family, `pipe` family)
103102
# TODO: expand tests of `continuations` to cases with named return values
104103
# TODO: update code examples in docs
105104

unpythonic/tests/test_fun.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,17 @@ def mymul_typed(y: int):
311311
test[inc2_then_double(3) == 10]
312312
test[double_then_inc2(3) == 8]
313313

314+
with testset("compose with multiple-return-values, named return values"):
315+
f = lambda x, y: Values(2 * x, 3 * y)
316+
g = lambda x, y: Values(x + 2, y + 3)
317+
f_then_g = composel(f, g)
318+
test[f_then_g(1, 2) == Values(4, 9)]
319+
320+
f = lambda x, y: Values(x=2 * x, y=3 * y)
321+
g = lambda x, y: Values(x=x + 2, y=y + 3)
322+
f_then_g = composel(f, g)
323+
test[f_then_g(1, 2) == Values(x=4, y=9)]
324+
314325
with testset("curry in compose chain"):
315326
def f1(a, b):
316327
return Values(2 * a, 3 * b)

0 commit comments

Comments
 (0)