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
b2ee9084
Commit
b2ee9084
authored
May 12, 2015
by
Olivier R-D
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add tests for data type and null node value
parent
3faa3c4c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
0 deletions
+31
-0
opcua/internal_subscription.py
opcua/internal_subscription.py
+3
-0
opcua/node.py
opcua/node.py
+7
-0
tests.py
tests.py
+21
-0
No files found.
opcua/internal_subscription.py
View file @
b2ee9084
...
...
@@ -20,6 +20,9 @@ class MonitoredItemData(object):
class
MonitoredItemService
(
object
):
"""
implement monitoreditem service for 1 subscription
"""
def
__init__
(
self
,
isub
,
aspace
):
self
.
logger
=
logging
.
getLogger
(
__name__
+
str
(
isub
.
data
.
SubscriptionId
))
...
...
opcua/node.py
View file @
b2ee9084
...
...
@@ -49,6 +49,13 @@ class Node(object):
result
=
self
.
get_attribute
(
ua
.
AttributeIds
.
DisplayName
)
return
result
.
Value
def
get_data_type
(
self
):
"""
get data type of node
"""
result
=
self
.
get_attribute
(
ua
.
AttributeIds
.
DataType
)
return
result
.
Value
def
get_node_class
(
self
):
"""
get node class attribute of node
...
...
tests.py
View file @
b2ee9084
...
...
@@ -353,6 +353,27 @@ class CommonTests(object):
self
.
assertEqual
(
nid
,
v
.
nodeid
)
self
.
assertEqual
(
qn
,
v
.
get_browse_name
())
def
test_null_variable
(
self
):
objects
=
self
.
opc
.
get_objects_node
()
var
=
objects
.
add_variable
(
3
,
'nullstring'
,
"a string"
)
var
.
set_value
(
None
)
val
=
var
.
get_value
()
self
.
assertEqual
(
val
,
None
)
var
.
set_value
(
""
)
val
=
var
.
get_value
()
self
.
assertNotEqual
(
val
,
None
)
self
.
assertEqual
(
val
,
""
)
def
test_variable_data_type
(
self
):
objects
=
self
.
opc
.
get_objects_node
()
var
=
objects
.
add_variable
(
3
,
'stringfordatatype'
,
"a string"
)
val
=
var
.
get_data_type
()
self
.
assertEqual
(
val
,
ua
.
NodeId
(
ua
.
ObjectIds
.
String
))
var
=
objects
.
add_variable
(
3
,
'stringarrayfordatatype'
,
[
"a"
,
"b"
])
val
=
var
.
get_data_type
()
self
.
assertEqual
(
val
,
ua
.
NodeId
(
ua
.
ObjectIds
.
String
))
def
test_add_string_array_variable
(
self
):
objects
=
self
.
opc
.
get_objects_node
()
v
=
objects
.
add_variable
(
'ns=3;s=stringarrayid;'
,
'9:stringarray'
,
[
'l'
,
'b'
])
...
...
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