We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2faaab0 commit d852cf5Copy full SHA for d852cf5
koerce/tests/test_patterns.py
@@ -520,6 +520,19 @@ def test_capture():
520
assert ctx == {"result": 12}
521
522
523
+def test_capture_with_deferred():
524
+ ctx = {}
525
+
526
+ x = Deferred(Variable("x"))
527
+ p = Capture(x, InstanceOf(float))
528
529
+ assert p.apply(1, context=ctx) is NoMatch
530
+ assert ctx == {}
531
532
+ assert p.apply(1.0, ctx) == 1.0
533
+ assert ctx == {"x": 1.0}
534
535
536
def test_none_of():
537
def negative(x):
538
return x < 0
0 commit comments