Esempio n. 1
0
 def test_string_property_io(self):
     io = Io()
     value = "I LOVE ADB"
     label = Label(cfg.INV_ID, value)
     label = io.write_label(label)
     property = Property(cfg.INV_ID, PropertyType.STRING, label, value,
                         None)
     written = io.write_property(property)
     retrieved = io.read_property(written.id)
     self.assertEqual(property.id, retrieved.id)
     self.assertEqual(property.value, retrieved.value)
     self.assertEqual(property.type.value, retrieved.type.value)
     self.assertEqual(property.label.value, retrieved.label.value)
     self.assertEqual(property.next_prop, retrieved.next_prop)
Esempio n. 2
0
    def test_int_property_io(self):
        io = Io()
        value3 = "I LOVE ADB3"
        value2 = "I LOVE ADB2"
        value1 = "I LOVE ADB1"

        prop_value = 1
        label3 = Label(cfg.INV_ID, value3)
        label2 = Label(cfg.INV_ID, value2)
        label1 = Label(cfg.INV_ID, value1)

        property = Property(cfg.INV_ID, PropertyType.INT, label1, 1, None)
        property2 = Property(cfg.INV_ID, PropertyType.INT, label2, 2, property)
        property3 = Property(cfg.INV_ID, PropertyType.INT, label3, 3,
                             property2)

        written = io.write_property(property3)
        retrieved = io.read_property(written.id)
        self.assertEqual(property3.id, retrieved.id)
        self.assertEqual(property3.value, retrieved.value)
        self.assertEqual(property3.type.value, retrieved.type.value)
        self.assertEqual(property3.label.value, retrieved.label.value)
        self.assertEqual(property3.next_prop.id, retrieved.next_prop.id)