from narval.public import AL_NS

plan = get_plan(memory)

# check plan state
assert_equals(plan.state, 'done')
# check steps'state
assert_equals(plan.elements['step1'].state, 'history')
assert_equals(plan.elements['step2'].state, 'done')

elements = list(get_elements(memory))
assert_equals(len(elements), 3) # 1 in memory, 2 produced
for elmt in elements:
    print elmt
    #print 'ELEMENT', getattr(elmt, 'el_id', 'EMPTY'), elmt.from_plan
    if hasattr(elmt, 'el_id') and elmt.from_plan:
        break
else:
    raise AssertionError('Step 2 element has not been taken from memory')

