def test_topology_tree_glo(): given = [ { 'location': 'CA' }, { 'location': 'GLO' }, ] expected = {'GLO': {'CA': {}}} assert topology.tree(given) == expected
def test_topology_tree(): given = [ # market group for electricity, low voltage, ecoinvent 3.3 { 'location': 'GLO' }, { 'location': 'CA' }, { 'location': 'Canada without Quebec' }, { 'location': 'RNA' }, { 'location': 'US' }, { 'location': 'CN' }, { 'location': 'ENTSO-E' }, { 'location': 'Europe without Switzerland' }, { 'location': 'RER' }, { 'location': 'UCTE' }, { 'location': 'RAF' }, { 'location': 'RAS' }, { 'location': 'RLA' }, { 'location': 'RME' }, ] expected = { 'GLO': { 'RNA': { 'CA': { 'Canada without Quebec': {} }, 'US': {} }, 'RAF': {}, 'RAS': { "CN": {}, "RME": {} }, 'RLA': {}, 'RER': { 'ENTSO-E': { 'UCTE': {} }, 'Europe without Switzerland': {} } } } assert topology.tree(given) == expected