'Verifies that the relations in the given block structure
equate the relations described in the children_map. Use the
missing_blocks parameter to pass in any blocks that were removed
from the block structure but still have a positional entry in
the children_map.'

def assert_block_structure(self, block_structure, children_map, missing_blocks=None):

    if (not missing_blocks):
        missing_blocks = []
    for (block_key, children) in enumerate(children_map):
        self.assertEqual((self.block_key_factory(block_key) in block_structure), (block_key not in missing_blocks), 'Expected    presence    in    block_structure    for    block_key    {}    to    match    absence    in    missing_blocks.'.format(unicode(block_key)))
        if (block_key not in missing_blocks):
            self.assertEqual(set(block_structure.get_children(self.block_key_factory(block_key))), set((self.block_key_factory(child) for child in children)))
    parents_map = self.get_parents_map(children_map)
    for (block_key, parents) in enumerate(parents_map):
        if (block_key not in missing_blocks):
            self.assertEqual(set(block_structure.get_parents(self.block_key_factory(block_key))), set((self.block_key_factory(parent) for parent in parents)))
