@@ -24,7 +24,7 @@ class XmlTests(object):
2424 assertEqual = dir
2525
2626 def test_xml_import (self ):
27- self .srv .import_xml ("tests/custom_nodes.xml" )
27+ self .opc .import_xml ("tests/custom_nodes.xml" )
2828 o = self .opc .get_objects_node ()
2929 v = o .get_child (["1:MyXMLFolder" , "1:MyXMLObject" , "1:MyXMLVariable" ])
3030 val = v .get_value ()
@@ -52,9 +52,9 @@ def test_xml_import_additional_ns(self):
5252 self .srv .register_namespace ('http://placeholder.toincrease.nsindex' ) # if not already shift the new namespaces
5353
5454 # "tests/custom_nodes.xml" isn't created with namespaces in mind, provide new test file
55- self .srv .import_xml ("tests/custom_nodesns.xml" ) # the ns=1 in to file now should be mapped to ns=2
55+ self .opc .import_xml ("tests/custom_nodesns.xml" ) # the ns=1 in to file now should be mapped to ns=2
5656
57- ns = self .srv .get_namespace_index ("http://examples.freeopcua.github.io/" )
57+ ns = self .opc .get_namespace_index ("http://examples.freeopcua.github.io/" )
5858 o = self .opc .get_objects_node ()
5959
6060 o2 = o .get_child (["{0:d}:MyBaseObject" .format (ns )])
@@ -102,7 +102,7 @@ def test_xml_vars(self):
102102 self .opc .register_namespace ("tititi" )
103103 self .opc .register_namespace ("whatthexxx" )
104104 o = self .opc .nodes .objects .add_object (2 , "xmlexportobj" )
105- v = o .add_variable (3 , "myxmlvar" , 6.78 , ua .VariantType .Float )
105+ v = o .add_variable (3 , "myxmlvar" , 6.78 , ua .VariantType .Double )
106106 a = o .add_variable (3 , "myxmlvar-array" , [6 , 1 ], ua .VariantType .UInt16 )
107107 a2 = o .add_variable (3 , "myxmlvar-2dim" , [[1 , 2 ], [3 , 4 ]], ua .VariantType .UInt32 )
108108 a3 = o .add_variable (3 , "myxmlvar-2dim" , [[]], ua .VariantType .ByteString )
@@ -113,7 +113,7 @@ def test_xml_vars(self):
113113 self .opc .import_xml ("export-vars.xml" )
114114
115115 self .assertEqual (v .get_value (), 6.78 )
116- self .assertEqual (v .get_data_type (), ua .NodeId (ua .ObjectIds .Float ))
116+ self .assertEqual (v .get_data_type (), ua .NodeId (ua .ObjectIds .Double ))
117117
118118 self .assertEqual (a .get_data_type (), ua .NodeId (ua .ObjectIds .UInt16 ))
119119 self .assertIn (a .get_value_rank (), (0 , 1 ))
@@ -135,7 +135,6 @@ def test_xml_ns(self):
135135 ns_array = self .opc .get_namespace_array ()
136136 if len (ns_array ) < 3 :
137137 self .opc .register_namespace ("dummy_ns" )
138- print ("ARRAY" , self .opc .get_namespace_array ())
139138
140139 ref_ns = self .opc .register_namespace ("ref_namespace" )
141140 new_ns = self .opc .register_namespace ("my_new_namespace" )
@@ -151,7 +150,6 @@ def test_xml_ns(self):
151150 o_bname = onew .add_object ("ns={0};i=4000" .format (new_ns ), "{0}:BNAME" .format (bname_ns ))
152151
153152 nodes = [o , o50 , o200 , onew , vnew , v_no_parent , o_bname ]
154- print ("CREATED" , nodes , o_no_export )
155153 self .opc .export_xml (nodes , "export-ns.xml" )
156154 # delete node and change index og new_ns before re-importing
157155 self .opc .delete_nodes (nodes )
@@ -165,10 +163,8 @@ def test_xml_ns(self):
165163 new_ns = self .opc .register_namespace ("my_new_namespace" )
166164
167165 new_nodes = self .opc .import_xml ("export-ns.xml" )
168- print ("NEW NODES" , new_nodes )
169166
170167 for i in [o , o50 , o200 ]:
171- print (i )
172168 i .get_browse_name ()
173169 with self .assertRaises (uaerrors .BadNodeIdUnknown ):
174170 onew .get_browse_name ()
@@ -179,11 +175,8 @@ def test_xml_ns(self):
179175 # get index of namespaces after import
180176 new_ns = self .opc .register_namespace ("my_new_namespace" )
181177 bname_ns = self .opc .register_namespace ("bname_namespace" )
182- print ("ARRAY 2" , self .opc .get_namespace_array ())
183178
184- print ("NEW NS" , new_ns , onew )
185179 onew .nodeid .NamespaceIndex = new_ns
186- print ("OENE" , onew )
187180 onew .get_browse_name ()
188181 vnew2 = onew .get_children ()[0 ]
189182 self .assertEqual (new_ns , vnew2 .nodeid .NamespaceIndex )
@@ -313,7 +306,8 @@ def test_xml_enumvalues(self):
313306 self ._test_xml_var_type (o , "enumvalues" )
314307
315308 def test_xml_custom_uint32 (self ):
316- t = self .opc .create_custom_data_type (2 , 'MyCustomUint32' , ua .ObjectIds .UInt32 )
309+ #t = self.opc.nodes. create_custom_data_type(2, 'MyCustomUint32', ua.ObjectIds.UInt32)
310+ t = self .opc .get_node (ua .ObjectIds .UInt32 ).add_data_type (2 , 'MyCustomUint32' )
317311 o = self .opc .nodes .objects .add_variable (2 , "xmlcustomunit32" , 0 , varianttype = ua .VariantType .UInt32 , datatype = t .nodeid )
318312 self ._test_xml_var_type (o , "cuint32" )
319313
0 commit comments