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
5d10d129
Commit
5d10d129
authored
Oct 22, 2016
by
olivier R-D
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add more tests for xml
parent
136b6fd0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
tests/tests_xml.py
tests/tests_xml.py
+37
-0
No files found.
tests/tests_xml.py
View file @
5d10d129
import
uuid
from
opcua
import
ua
from
opcua
import
ua
from
opcua
import
uamethod
from
opcua
import
uamethod
...
@@ -197,3 +198,39 @@ class XmlTests(object):
...
@@ -197,3 +198,39 @@ class XmlTests(object):
onew
.
get_browse_name
()
onew
.
get_browse_name
()
vnew2
=
onew
.
get_children
()[
0
]
vnew2
=
onew
.
get_children
()[
0
]
self
.
assertEqual
(
new_ns
,
vnew2
.
nodeid
.
NamespaceIndex
)
self
.
assertEqual
(
new_ns
,
vnew2
.
nodeid
.
NamespaceIndex
)
def
test_xml_float
(
self
):
o
=
self
.
opc
.
nodes
.
objects
.
add_variable
(
2
,
"xmlfloat"
,
5.67
)
dtype
=
o
.
get_data_type
()
dv
=
o
.
get_data_value
()
self
.
opc
.
export_xml
([
o
],
"export-float.xml"
)
self
.
opc
.
delete_nodes
([
o
])
new_nodes
=
self
.
opc
.
import_xml
(
"export-float.xml"
)
o2
=
self
.
opc
.
get_node
(
new_nodes
[
0
])
self
.
assertEqual
(
o
,
o2
)
self
.
assertEqual
(
dtype
,
o2
.
get_data_type
())
self
.
assertEqual
(
dv
.
Value
,
o2
.
get_data_value
().
Value
)
def
test_xml_bool
(
self
):
o
=
self
.
opc
.
nodes
.
objects
.
add_variable
(
2
,
"xmlbool"
,
True
)
self
.
_test_xml_var_type
(
o
,
"bool"
)
def
test_xml_guid
(
self
):
o
=
self
.
opc
.
nodes
.
objects
.
add_variable
(
2
,
"xmlguid"
,
uuid
.
uuid4
())
self
.
_test_xml_var_type
(
o
,
"guid"
)
def
_test_xml_var_type
(
self
,
node
,
typename
):
dtype
=
node
.
get_data_type
()
dv
=
node
.
get_data_value
()
path
=
"export-{}.xml"
.
format
(
typename
)
self
.
opc
.
export_xml
([
node
],
path
)
self
.
opc
.
delete_nodes
([
node
])
new_nodes
=
self
.
opc
.
import_xml
(
path
)
node2
=
self
.
opc
.
get_node
(
new_nodes
[
0
])
self
.
assertEqual
(
node
,
node2
)
self
.
assertEqual
(
dtype
,
node2
.
get_data_type
())
self
.
assertEqual
(
dv
.
Value
,
node2
.
get_data_value
().
Value
)
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