Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
opcua-asyncio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nikola Balog
opcua-asyncio
Commits
cb200b39
Commit
cb200b39
authored
Oct 17, 2015
by
olivier R-D
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add some bool tests
parent
61b80064
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
tests.py
tests.py
+44
-0
No files found.
tests.py
View file @
cb200b39
...
...
@@ -522,6 +522,17 @@ class CommonTests(object):
val
=
v
.
get_value
()
self
.
assertEqual
([
1
,
2
,
3
],
val
)
def
test_bool_variable
(
self
):
o
=
self
.
opc
.
get_objects_node
()
v
=
o
.
add_variable
(
3
,
'BoolVariable'
,
True
)
dt
=
v
.
get_data_type
()
self
.
assertEqual
(
dt
,
ua
.
TwoByteNodeId
(
ua
.
ObjectIds
.
Boolean
))
val
=
v
.
get_value
()
self
.
assertEqual
(
True
,
val
)
v
.
set_value
(
False
)
val
=
v
.
get_value
()
self
.
assertEqual
(
False
,
val
)
def
test_array_size_one_value
(
self
):
o
=
self
.
opc
.
get_objects_node
()
v
=
o
.
add_variable
(
3
,
'VariableArrayValue'
,
[
1
,
2
,
3
])
...
...
@@ -577,6 +588,39 @@ class CommonTests(object):
with
self
.
assertRaises
(
Exception
):
sub
.
unsubscribe
(
handle1
)
# sub does not exist anymore
def
test_subscription_data_change_bool
(
self
):
'''
test subscriptions. This is far too complicated for
a unittest but, setting up subscriptions requires a lot
of code, so when we first set it up, it is best
to test as many things as possible
'''
msclt
=
MySubHandler
()
o
=
self
.
opc
.
get_objects_node
()
# subscribe to a variable
startv1
=
True
v1
=
o
.
add_variable
(
3
,
'SubscriptionVariableBool'
,
startv1
)
sub
=
self
.
opc
.
create_subscription
(
100
,
msclt
)
handle1
=
sub
.
subscribe_data_change
(
v1
)
# Now check we get the start value
clthandle
,
node
,
val
,
attr
=
msclt
.
future
.
result
()
self
.
assertEqual
(
val
,
startv1
)
self
.
assertEqual
(
node
,
v1
)
msclt
.
reset
()
# reset future object
# modify v1 and check we get value
v1
.
set_value
(
False
)
clthandle
,
node
,
val
,
attr
=
msclt
.
future
.
result
()
self
.
assertEqual
(
node
,
v1
)
self
.
assertEqual
(
val
,
False
)
sub
.
delete
()
# should delete our monitoreditem too
def
test_subscribe_server_time
(
self
):
msclt
=
MySubHandler
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment