22 super().
__init__(owner, name, description)
25 self.
myOutput1 = ac.ArrayOutput(ac.DataType.int32, self,
"ArrayOut1",
"SomeUnit", 10,
"my fancy description")
26 self.
myOutput2 = ac.ArrayOutput(ac.DataType.int32, self,
"ArrayOut2",
"SomeUnit", 10,
"my fancy description")
33 "my fancy description")
35 self.
myInput1 = ac.ArrayPushInput(ac.DataType.int32, self,
"ArrayIn1",
"unit", 2,
"description")
36 self.
myInput2 = ac.ArrayPushInput(ac.DataType.int32, self,
"ArrayIn2",
"unit", 5,
"description")
37 self.
myInputPoll = ac.ArrayPollInput(ac.DataType.int32, self,
"ArrayInPOLL",
"unit", 2,
"description")
38 self.
myInputWB = ac.ArrayPushInputWB(ac.DataType.int32, self,
"ArrayInWB",
"unit", 1,
"description")
41 self.
testError = ac.ScalarOutput(ac.DataType.string, self,
"TestError",
"",
"")
48 assert self.
myOutput1.getName() ==
"/SomeName/ArrayOut1"
49 assert self.
myOutput1.getUnit() ==
"SomeUnit"
50 assert "Root for Python Modules - Module's description - my fancy description" in self.
myOutput1.getDescription()
51 assert self.
myOutput1.getValueType() == ac.DataType.int32
52 assert self.
myOutput1.getVersionNumber() == ac.VersionNumber(
None)
53 assert self.
myOutput1.isReadOnly() ==
False
54 assert self.
myOutput1.isReadable() ==
False
56 assert str(self.
myOutput1.getId()).startswith(
'0x')
58 assert self.
myOutput1.dataValidity() == ac.DataValidity.ok
63 self.
myOutput1.setAndWrite(range(valSum, valSum + 10))
65 valcopy = np.array(self.
myInput1, copy=
True)
66 assert (self.
myInput1 == valcopy).all()
70 assert ((self.
myInput1 == valcopy) == [
False,
True]).all()
71 assert ((self.
myInput1 != valcopy) == [
True,
False]).all()
72 assert ((self.
myInput1 <= valcopy) == [
False,
True]).all()
73 assert ((self.
myInput1 < valcopy) == [
False,
False]).all()
74 assert ((self.
myInput1 >= valcopy) == [
True,
True]).all()
75 assert ((self.
myInput1 > valcopy) == [
True,
False]).all()
77 assert ((valcopy == self.
myInput1) == [
False,
True]).all()
78 assert ((valcopy != self.
myInput1) == [
True,
False]).all()
79 assert ((valcopy >= self.
myInput1) == [
False,
True]).all()
80 assert ((valcopy > self.
myInput1) == [
False,
False]).all()
81 assert ((valcopy <= self.
myInput1) == [
True,
True]).all()
82 assert ((valcopy < self.
myInput1) == [
True,
False]).all()
90 assert ((self.
myInput1 == [123, 234]) == [
True,
True]).all()
106 self.
myOutput2.set(range(valSum, valSum + 10))
109 for i
in range(0, 5):
124 except AssertionError
as e:
125 print(
"\n".join(traceback.format_exception(e)))
127 self.
testError.setAndWrite(
"\n".join(traceback.format_exception(e)))