Skip to content
Snippets Groups Projects

Quality of life

Merged Cyril Moineau requested to merge QualityOfLife into dev
Files
22
@@ -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__':
Loading