Skip to content
Snippets Groups Projects
Commit 5686ecb8 authored by Cyril Moineau's avatar Cyril Moineau
Browse files

Add unittest for magic method setter and attribute set by kwargs.

parent d68006ec
No related branches found
No related tags found
2 merge requests!105version 0.2.0,!73Quality of life
Pipeline #37498 failed
...@@ -125,6 +125,23 @@ class test_operator_binding(unittest.TestCase): ...@@ -125,6 +125,23 @@ class test_operator_binding(unittest.TestCase):
generic_op.forward() # Increment idx generic_op.forward() # Increment idx
self.assertEqual(customImpl.idx, 1) self.assertEqual(customImpl.idx, 1)
def test_magic_meth(self):
myVar = 2
myBool = True
# Test dynamic attribute set
gop = aidge_core.GenericOperator("test", 1, 0, 1, "FictiveName", myVar=myVar).get_operator()
gop.myBool = myBool
# Test variable set by kwargs
self.assertEqual(gop.myVar, myVar)
# Test set attr
self.assertEqual(gop.myBool, myBool)
# Test static attribute set !
prod = aidge_core.Producer([1]).get_operator()
self.assertEqual(prod.Constant, False)
prod.Constant = True # By default Constant is False
self.assertEqual(prod.Constant, True)
if __name__ == '__main__': if __name__ == '__main__':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment