

def test_order(db_conn, units_table):
    '\n    Expect to order units by the number of depending units.\n    '
    add_test_set(db_conn, units_table=units_table)
    units = Unit.list_by_entity_ids(db_conn, ['add', 'subtract', 'multiply', 'divide'])
    units = order_units_by_need(units)
    entity_ids = [unit['entity_id'] for unit in units]
    assert (entity_ids[0] == 'add')
    assert (entity_ids[1] in ('subtract', 'multiply'))
    assert (entity_ids[2] in ('subtract', 'multiply'))
    assert (entity_ids[3] == 'divide')

dataset/ETHPy150Open heiskr/sagefy/server/test/test_modules_sequencer_traversal.py test_order/original