From bf4f29cda0443ff3425f9e49289d1167a8d0603c Mon Sep 17 00:00:00 2001 From: Stan Lagun Date: Wed, 10 Feb 2016 18:42:55 +0300 Subject: [PATCH] Adds unit test for ability to pass lambda from Python Change-Id: I21271650040763cb0db17a55ad6685ba19dbbbfc --- yaql/tests/test_miscellaneous.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/yaql/tests/test_miscellaneous.py b/yaql/tests/test_miscellaneous.py index 268b6bc..b24e4e5 100644 --- a/yaql/tests/test_miscellaneous.py +++ b/yaql/tests/test_miscellaneous.py @@ -20,6 +20,17 @@ import yaql.tests class TestMiscellaneous(yaql.tests.TestCase): + def test_pass_lambda_from_code(self): + self.assertEqual( + [], + list(self.context('where', self.engine, [1, 2, 3])(False)) + ) + self.assertEqual( + [2, 3], + list(self.context('where', self.engine, [1, 2, 3])( + lambda t: t > 1)) + ) + def test_bool_is_not_an_integer(self): @specs.parameter('arg', yaqltypes.Integer()) def foo(arg):