21 super().
__init__(owner, name, description)
24 self.
myOutput1 = ac.ArrayOutput(ac.DataType.int32, self,
"ArrayOut1" ,
"SomeUnit", 10,
"my fancy description")
25 self.
myOutput2 = ac.ArrayOutput(ac.DataType.int32, self,
"ArrayOut2" ,
"SomeUnit", 10,
"my fancy description")
26 self.
myOutputRB = ac.ArrayOutputPushRB(ac.DataType.int32, self,
"ArrayOutRB" ,
"SomeUnit", 2,
"my fancy description")
28 self.
myInput1 = ac.ArrayPushInput(ac.DataType.int32, self,
"ArrayIn1",
"unit", 2,
"description")
29 self.
myInput2 = ac.ArrayPushInput(ac.DataType.int32, self,
"ArrayIn2",
"unit", 5,
"description")
30 self.
myInputPoll = ac.ArrayPollInput(ac.DataType.int32, self,
"ArrayInPOLL",
"unit", 2,
"description")
31 self.
myInputWB = ac.ArrayPushInputWB(ac.DataType.int32, self,
"ArrayInWB",
"unit", 1,
"description")
34 self.
testError = ac.ScalarOutput(ac.DataType.string, self,
"TestError",
"",
"")
41 assert self.
myOutput1.getName() ==
"/SomeName/ArrayOut1"
42 assert self.
myOutput1.getUnit() ==
"SomeUnit"
43 assert "Root for Python Modules - Module's description - my fancy description" in self.
myOutput1.getDescription()
44 assert self.
myOutput1.getValueType() == ac.DataType.int32
45 assert self.
myOutput1.getVersionNumber() == ac.VersionNumber(
None)
46 assert self.
myOutput1.isReadOnly() ==
False
47 assert self.
myOutput1.isReadable() ==
False
48 assert self.
myOutput1.isWriteable() ==
True
49 assert str(self.
myOutput1.getId()).startswith(
'0x')
51 assert self.
myOutput1.dataValidity() == ac.DataValidity.ok
56 self.
myOutput1.setAndWrite(range(valSum,valSum+10))
58 valcopy = np.array(self.
myInput1, copy=
True)
59 assert (self.
myInput1 == valcopy).all()
63 assert ((self.
myInput1 == valcopy) == [
False,
True]).all()
64 assert ((self.
myInput1 != valcopy) == [
True,
False]).all()
65 assert ((self.
myInput1 <= valcopy) == [
False,
True]).all()
66 assert ((self.
myInput1 < valcopy) == [
False,
False]).all()
67 assert ((self.
myInput1 >= valcopy) == [
True,
True]).all()
68 assert ((self.
myInput1 > valcopy) == [
True,
False]).all()
70 assert ((valcopy == self.
myInput1) == [
False,
True]).all()
71 assert ((valcopy != self.
myInput1) == [
True,
False]).all()
72 assert ((valcopy >= self.
myInput1) == [
False,
True]).all()
73 assert ((valcopy > self.
myInput1) == [
False,
False]).all()
74 assert ((valcopy <= self.
myInput1) == [
True,
True]).all()
75 assert ((valcopy < self.
myInput1) == [
True,
False]).all()
83 assert ((self.
myInput1 == [123,234]) == [
True,
True]).all()
100 self.
myOutput2.set(range(valSum,valSum+10))
103 for i
in range(0,5) :
118 except AssertionError
as e:
119 print(
"\n".join(traceback.format_exception(e)))
121 self.
testError.setAndWrite(
"\n".join(traceback.format_exception(e)))