Beispiel #1
0
def test_layer_record():
    tagged_blocks = TaggedBlocks([
        (TaggedBlockID.LAYER_VERSION, TaggedBlock(key=TaggedBlockID.LAYER_VERSION, data=IntegerElement(0))),
    ])
    check_write_read(LayerRecord())
    check_write_read(LayerRecord(name='foo', tagged_blocks=tagged_blocks))
    check_write_read(LayerRecord(tagged_blocks=tagged_blocks), version=2)
def test_tagged_blocks():
    blocks = TaggedBlocks([(TaggedBlockID.LAYER_VERSION,
                            TaggedBlock(key=TaggedBlockID.LAYER_VERSION,
                                        data=IntegerElement(1)))])
    check_write_read(blocks)
    check_write_read(blocks, version=2)
    check_write_read(blocks, version=2, padding=4)
Beispiel #3
0
def test_tagged_blocks():
    blocks = TaggedBlocks([(Tag.LAYER_VERSION,
                            TaggedBlock(key=Tag.LAYER_VERSION,
                                        data=IntegerElement(1)))])
    check_write_read(blocks)
    check_write_read(blocks, version=2)
    check_write_read(blocks, version=2, padding=4)
    display(blocks)
    assert blocks.get_data(Tag.LAYER_VERSION)
    assert blocks.get_data(Tag.LAYER_ID) is None
    assert len([1 for key in blocks if key == Tag.LAYER_VERSION]) == 1
def test_tagged_block(key, data, version, padding):
    check_write_read(TaggedBlock(key=key, data=data),
                     version=version,
                     padding=padding)