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

Method test_variant

tests/tests_unit.py:499–511  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

497 dv.SourceTimestamp = now
498
499 def test_variant(self):
500 dv = ua.Variant(True, ua.VariantType.Boolean)
501 self.assertEqual(dv.Value, True)
502 self.assertEqual(type(dv.Value), bool)
503 now = datetime.utcnow()
504 v = ua.Variant(now)
505 self.assertEqual(v.Value, now)
506 self.assertEqual(v.VariantType, ua.VariantType.DateTime)
507 v2 = variant_from_binary(ua.utils.Buffer(variant_to_binary(v)))
508 self.assertEqual(v.Value, v2.Value)
509 self.assertEqual(v.VariantType, v2.VariantType)
510 # commonity method:
511 self.assertEqual(v, ua.Variant(v))
512
513 def test_variant_array(self):
514 v = ua.Variant([1, 2, 3, 4, 5])

Callers

nothing calls this directly

Calls 2

variant_from_binaryFunction · 0.90
variant_to_binaryFunction · 0.90

Tested by

no test coverage detected