Skip to content

Commit

Permalink
test_lang.py and test_port.py
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz committed Nov 27, 2024
1 parent bc58b36 commit 8c57147
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions test/test_lang.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 7 additions & 2 deletions test/test_port.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))


Expand Down Expand Up @@ -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))

0 comments on commit 8c57147

Please sign in to comment.