From 8c5714771ac3d74cb68d0d3abc12383a929264e5 Mon Sep 17 00:00:00 2001 From: Jusong Yu Date: Wed, 27 Nov 2024 14:38:19 +0100 Subject: [PATCH] test_lang.py and test_port.py --- test/test_lang.py | 6 +++--- test/test_port.py | 9 +++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/test/test_lang.py b/test/test_lang.py index 42125394..a55af31a 100644 --- a/test/test_lang.py +++ b/test/test_lang.py @@ -21,19 +21,19 @@ def protected_property(self): def protected_fn_nocheck(self): return self._a - def testA(self): + def testA(self): # noqa: N802 self.protected_fn() self.protected_property class B(A): - def testB(self): + def testB(self): # noqa: N802 self.protected_fn() self.protected_property class C(B): - def testC(self): + def testC(self): # noqa: N802 self.protected_fn() self.protected_property diff --git a/test/test_port.py b/test/test_port.py index 1809f326..b0535fdb 100644 --- a/test/test_port.py +++ b/test/test_port.py @@ -78,7 +78,10 @@ def test_lambda_default(self): # Testing that passing an actual lambda as a value is alos possible port = InputPort('test', valid_type=(types.FunctionType, int), default=lambda: 5) - some_lambda = lambda: 'string' + + def some_lambda(): + "string" + self.assertIsNone(port.validate(some_lambda)) @@ -366,7 +369,9 @@ def test_port_namespace_lambda_defaults(self): self.assertIsNone(port_namespace.validate(inputs)) # When passing a lambda directly as the value, it should NOT be evaluated during pre_processing - some_lambda = lambda: 5 + def some_lambda(): + return 5 + inputs = port_namespace.pre_process({'lambda_default': some_lambda}) self.assertEqual(inputs['lambda_default'], some_lambda) self.assertIsNone(port_namespace.validate(inputs))