def test_get_canonical_architecture_order_with_named_sources(): arch = { 'A': { '@type': 'Input', '@outgoing_connections': {'out1': ['B1'], 'out2': ['C']} }, 'B1': { '@type': 'layertype', '@outgoing_connections': {'B2'} }, 'B2': { '@type': 'layertype', '@outgoing_connections': {'D.source1'} }, 'C': { '@type': 'layertype', '@outgoing_connections': {'D.source1'} }, 'D': { '@type': 'layertype', '@outgoing_connections': set() } } assert get_canonical_layer_order(arch) == ['A', 'B1', 'B2', 'C', 'D']
def test_get_canonical_architecture_order(): arch = { 'A': { '@type': 'Input', '@outgoing_connections': {'B1', 'C'} }, 'B1': { '@type': 'layertype', '@outgoing_connections': {'B2'} }, 'B2': { '@type': 'layertype', '@outgoing_connections': {'D'} }, 'C': { '@type': 'layertype', '@outgoing_connections': {'D'} }, 'D': { '@type': 'layertype', '@outgoing_connections': set() } } assert get_canonical_layer_order(arch) == ['A', 'B1', 'B2', 'C', 'D']