Ejemplo n.º 1
0
def test_parse_metaentry():
    g = helpers.create_group()
    e = helpers.create_metaentry(g)
    root = RootGroup().parse(g.to_bytearray() + e.to_bytearray(), 1, 1)

    entries = root.get_groups()[0].get_meta_entries()
    assert len(entries) == 1
    helpers.equal_entries(e, entries[0])
Ejemplo n.º 2
0
def test_parse_entry():
    g = helpers.create_group()
    e = helpers.create_entry(g)
    root = RootGroup().parse(g.to_bytearray() + e.to_bytearray(), 1, 1)

    groups = root.get_groups()
    assert len(groups) == 1
    g2 = groups[0]
    helpers.equal_groups(g, g2)

    entries = g2.get_entries()
    assert len(entries) == 1
    helpers.equal_entries(e, entries[0])
Ejemplo n.º 3
0
def test_parse_with_subgroups():
    g = helpers.create_group(0)
    g2 = helpers.create_group(1)
    g3 = helpers.create_group(1)
    e = helpers.create_entry(g3)

    root = RootGroup().parse(g.to_bytearray() + g2.to_bytearray() + g3.to_bytearray() + e.to_bytearray(), 3, 1)

    groups = root.get_groups()
    assert len(groups) == 1

    rg = groups[0]
    groups = rg.get_groups()
    print len(groups)
    assert len(groups) == 2

    pg = groups[1]
    helpers.equal_groups(g3, pg)

    entries = pg.get_entries()
    assert len(entries) == 1
    helpers.equal_entries(e, entries[0])