(self)
| 71 | self.assertEqual(r3.NodeId.NamespaceIndex, ns) |
| 72 | |
| 73 | def test_xml_method(self): |
| 74 | self.opc.register_namespace("tititi") |
| 75 | self.opc.register_namespace("whatthefuck") |
| 76 | o = self.opc.nodes.objects.add_object(2, "xmlexportmethod") |
| 77 | m = o.add_method(2, "callme", func, [ua.VariantType.Double, ua.VariantType.String], [ua.VariantType.Float]) |
| 78 | # set an arg dimension to a list to test list export |
| 79 | inputs = m.get_child("InputArguments") |
| 80 | val = inputs.get_value() |
| 81 | val[0].ArrayDimensions = [2, 2] |
| 82 | desc = "My nce description" |
| 83 | val[0].Description = ua.LocalizedText(desc) |
| 84 | inputs.set_value(val) |
| 85 | |
| 86 | # get all nodes and export |
| 87 | nodes = [o, m] |
| 88 | nodes.extend(m.get_children()) |
| 89 | self.opc.export_xml(nodes, "tmp_test_export.xml") |
| 90 | |
| 91 | self.opc.delete_nodes(nodes) |
| 92 | self.opc.import_xml("tmp_test_export.xml") |
| 93 | |
| 94 | # now see if our nodes are here |
| 95 | val = inputs.get_value() |
| 96 | self.assertEqual(len(val), 2) |
| 97 | |
| 98 | self.assertEqual(val[0].ArrayDimensions, [2, 2]) |
| 99 | self.assertEqual(val[0].Description.Text, desc) |
| 100 | |
| 101 | def test_xml_vars(self): |
| 102 | self.opc.register_namespace("tititi") |
nothing calls this directly
no test coverage detected