Esempio n. 1
0
 def test_complex_construction(self):
     """
     Test complex object construction.
     """
     source = {
         "description": "some desc",
         "type": "sensor",
         "uuid": "26d6e362-a422-11ea-bb37-0242ac130002",
         "datatype": "uint8",
         "unit": "km",
         "min": 0,
         "max": 100,
         "enum": ["one", "two"],
         "aggregate": False,
         "default": "test-default",
         "instances": ["i1", "i2"]
     }
     node = VSSNode("test", source)
     self.assertIsNotNone(node)
     self.assertEqual("some desc", node.description)
     self.assertEqual(VSSType.SENSOR, node.type)
     self.assertEqual("26d6e362-a422-11ea-bb37-0242ac130002", node.uuid)
     self.assertEqual(VSSDataType.UINT8, node.data_type)
     self.assertEqual(Unit.KILOMETER, node.unit)
     self.assertEqual(0, node.min)
     self.assertEqual(100, node.max)
     self.assertEqual(["one", "two"], node.enum)
     self.assertEqual(False, node.aggregate)
     self.assertEqual("test-default", node.default_value)
     self.assertEqual(["i1", "i2"], node.instances)
     self.assertTrue(node.has_unit())
     self.assertTrue(node.has_data_type())
     self.assertFalse(node.is_private())
Esempio n. 2
0
 def test_simple_construction(self):
     """
     Test minimal object construction.
     """
     source = {"description": "some desc", "type": "branch", "uuid": "26d6e362-a422-11ea-bb37-0242ac130002", "$file_name$": "testfile" }
     node = VSSNode("test", source)
     self.assertIsNotNone(node)
     self.assertEqual("some desc", node.description)
     self.assertEqual(VSSType.BRANCH, node.type)
     self.assertEqual("26d6e362-a422-11ea-bb37-0242ac130002", node.uuid)
     self.assertFalse(node.has_unit())
     self.assertFalse(node.has_data_type())
     self.assertFalse(node.is_private())