MCPcopy Create free account
hub / github.com/FreeOpcUa/python-opcua / test_load_enum_strings

Method test_load_enum_strings

tests/tests_server.py:493–501  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

491 self.assertRaises(ValueError, ua_utils.get_nodes_of_namespace, self.opc, namespaces='non_existing_ns')
492
493 def test_load_enum_strings(self):
494 dt = self.opc.nodes.enum_data_type.add_data_type(0, "MyStringEnum")
495 dt.add_variable(0, "EnumStrings", [ua.LocalizedText("e1"), ua.LocalizedText("e2"), ua.LocalizedText("e3"), ua.LocalizedText("e 4")])
496 self.opc.load_enums()
497 e = getattr(ua, "MyStringEnum")
498 self.assertIsInstance(e, EnumMeta)
499 self.assertTrue(hasattr(e, "e1"))
500 self.assertTrue(hasattr(e, "e4"))
501 self.assertEqual(getattr(e, "e4"), 3)
502
503 def test_load_enum_values(self):
504 dt = self.opc.nodes.enum_data_type.add_data_type(0, "MyValuesEnum")

Callers

nothing calls this directly

Calls 3

add_data_typeMethod · 0.80
add_variableMethod · 0.45
load_enumsMethod · 0.45

Tested by

no test coverage detected