コード例 #1
0
    def test_empty(self):
        """ Test an empty database. """
        ext = self.__get_extension()
        self.assertEquals(255, ext.read_extension_data('TestModel', 1, EextByte(),'test'))
        self.assertEquals("", ext.read_extension_data('TestModel', 1, EextString(),'test'))

        self.assertEquals(255, ext.read_extension_data('TestModel', 2, EextByte(),'test'))
        self.assertEquals("", ext.read_extension_data('TestModel', 2, EextString(),'test'))
コード例 #2
0
    def test_write_read_int(self):
        """ Test read and write using integer data. """
        ext = self.__get_extension()
        ext.write_extension_data('TestModel', 1, EextByte(), 'test', 123)
        self.assertEquals(123, ext.read_extension_data('TestModel', 1, EextByte(), 'test'))

        ext.write_extension_data('TestModel', 1, EextByte(), 'test', 456)
        self.assertEquals(456, ext.read_extension_data('TestModel', 1, EextByte(),'test'))

        ext.write_extension_data('TestModel', 2, EextByte(), 'test', 789)
        self.assertEquals(456, ext.read_extension_data('TestModel', 1, EextByte(),'test'))
        self.assertEquals(789, ext.read_extension_data('TestModel', 2, EextByte(), 'test'))
コード例 #3
0
class Model9(EepromModel):
    """ Dummy model with multiple fields, including eext fields, without an id. """
    id = EepromId(10)
    name = EextString()
    floor = EextByte()
コード例 #4
0
class Model8(EepromModel):
    """ Dummy model with multiple fields, including eext fields, without an id. """
    name = EepromString(10, (1, 4))
    link = EepromByte((1, 14))
    room = EextByte()
コード例 #5
0
class Model7(EepromModel):
    """ Dummy model with multiple fields, including eext fields and an id. """
    id = EepromId(3)
    name = EepromString(10, lambda id: (id, 4))
    link = EepromByte(lambda id: (id, 14))
    room = EextByte()
コード例 #6
0
 class TestModel(EepromModel):
     id = EepromId(102)
     normal_eeprom_field = EepromByte((0, 6))
     int_field = EextByte()
     str_field = EextString()