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.
myInput3 = ac.ArrayPushInput(ac.DataType.float32, self,
"ArrayIn3",
"unit", 2,
"description")
38 self.
myInputPoll = ac.ArrayPollInput(ac.DataType.int32, self,
"ArrayInPOLL",
"unit", 2,
"description")
39 self.
myInputWB = ac.ArrayPushInputWB(ac.DataType.int32, self,
"ArrayInWB",
"unit", 1,
"description")
42 self.
testError = ac.ScalarOutput(ac.DataType.string, self,
"TestError",
"",
"")
49 assert self.
myOutput1.getName() ==
"/SomeName/ArrayOut1"
50 assert self.
myOutput1.getUnit() ==
"SomeUnit"
51 assert "Root for Python Modules - Module's description - my fancy description" in self.
myOutput1.getDescription()
52 assert self.
myOutput1.getValueType() == ac.DataType.int32
53 assert self.
myOutput1.getVersionNumber() == ac.VersionNumber(
None)
54 assert self.
myOutput1.isReadOnly() ==
False
55 assert self.
myOutput1.isReadable() ==
False
57 assert str(self.
myOutput1.getId()).startswith(
'0x')
59 assert self.
myOutput1.dataValidity() == ac.DataValidity.ok
64 self.
myOutput1.setAndWrite(range(valSum, valSum + 10))
66 valcopy = np.array(self.
myInput1, copy=
True)
67 assert (self.
myInput1 == valcopy).all()
71 assert ((self.
myInput1 == valcopy) == [
False,
True]).all()
72 assert ((self.
myInput1 != valcopy) == [
True,
False]).all()
73 assert ((self.
myInput1 <= valcopy) == [
False,
True]).all()
74 assert ((self.
myInput1 < valcopy) == [
False,
False]).all()
75 assert ((self.
myInput1 >= valcopy) == [
True,
True]).all()
76 assert ((self.
myInput1 > valcopy) == [
True,
False]).all()
78 assert ((valcopy == self.
myInput1) == [
False,
True]).all()
79 assert ((valcopy != self.
myInput1) == [
True,
False]).all()
80 assert ((valcopy >= self.
myInput1) == [
False,
True]).all()
81 assert ((valcopy > self.
myInput1) == [
False,
False]).all()
82 assert ((valcopy <= self.
myInput1) == [
True,
True]).all()
83 assert ((valcopy < self.
myInput1) == [
True,
False]).all()
89 self.
myInput1.set(np.array([12, 23], dtype=np.int32))
92 assert ((self.
myInput1 == [12, 23]) == [
True,
True]).all()
97 assert ((self.
myInput1 == [123, 234]) == [
True,
True]).all()
100 self.
myInput3.set(np.array([1.1, 6.6], dtype=np.float32))
101 assert self.
myInput3[0] == np.float32(1.1)
102 assert self.
myInput3[1] == np.float32(6.6)
104 assert self.
myInput3[0] == np.float32(1.2)
105 assert self.
myInput3[1] == np.float32(6.7)
106 self.
myInput3.set([np.float64(1.1), np.float64(6.6)])
107 assert self.
myInput3[0] == np.float32(1.1)
108 assert self.
myInput3[1] == np.float32(6.6)
109 self.
myInput3.set([np.float32(1.1), np.float32(6.6)])
111 assert type(self.
myInput3[0])
is np.float32
112 assert type(self.
myInput3[1])
is np.float32
113 assert self.
myInput3[0] == np.float32(1.1)
114 assert self.
myInput3[1] == np.float32(6.6)
117 assert self.
myInput3[0] == np.float32(1.3)
118 assert self.
myInput3[1] == np.float32(1.3)
119 self.
myInput3[0:2:1] = np.float32(1.5)
146 self.
myOutput2.set(range(valSum, valSum + 10))
149 for i
in range(0, 5):
164 except AssertionError
as e:
165 print(
"\n".join(traceback.format_exception(e)))
167 self.
testError.setAndWrite(
"\n".join(traceback.format_exception(e)))