def test_get_activity_metadata_indexing(no_init): given = [ [ "Activity", "mounted printed circuit board", "", "", "", "", "", "", "", "", "", "", "", "", ], [ "arbitrary", "metadata", "", "", "", "", "", "", "", "", "", "", "", "" ], ["unit", "kilogram", "", "", "", "", "", "", "", "", "", "", "", ""], ["", "", "", "", "", "", "", "", "", "", "", "", "", ""], ["Parameters", "", "", "", "", "", "", "", "", "", "", "", "", ""], ] ei = ExcelImporter() ei.db_name = "db" expected = { "arbitrary": "metadata", "database": "db", "name": "mounted printed circuit board", "exchanges": [], "unit": "kilogram", "worksheet name": "a", } assert ei.get_activity("a", given) == expected given = [ [ "Activity", "mounted printed circuit board", "", "", "", "", "", "", "", "", "", "", "", "", ], [ "arbitrary", "metadata", "", "", "", "", "", "", "", "", "", "", "", "" ], ["unit", "kilogram", "", "", "", "", "", "", "", "", "", "", "", ""], ["", "", "", "", "", "", "", "", "", "", "", "", "", ""], ] ei = ExcelImporter() ei.db_name = "db" expected = { "arbitrary": "metadata", "database": "db", "name": "mounted printed circuit board", "exchanges": [], "unit": "kilogram", "worksheet name": "a", } assert ei.get_activity("a", given) == expected given = [ [ "Activity", "mounted printed circuit board", "", "", "", "", "", "", "", "", "", "", "", "", ], [ "arbitrary", "metadata", "", "", "", "", "", "", "", "", "", "", "", "" ], ["unit", "kilogram", "", "", "", "", "", "", "", "", "", "", "", ""], ] ei = ExcelImporter() ei.db_name = "db" expected = { "arbitrary": "metadata", "database": "db", "name": "mounted printed circuit board", "exchanges": [], "unit": "kilogram", "worksheet name": "a", } assert ei.get_activity("a", given) == expected
def test_get_activity(no_init): given = [ [ 'Activity', 'mounted printed circuit board', '', '', '', '', '', '', '', '', '', '', '', '' ], [ 'comment', 'something important here maybe?', '', '', '', '', '', '', '', '', '', '', '', '' ], [ 'arbitrary', 'metadata', '', '', '', '', '', '', '', '', '', '', '', '' ], ['location', 'GLO', '', '', '', '', '', '', '', '', '', '', '', ''], ['type', 'process', '', '', '', '', '', '', '', '', '', '', '', ''], ['unit', 'kilogram', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['Parameters', '', '', '', '', '', '', '', '', '', '', '', '', ''], [ 'name', 'amount', 'formula', '', '', '', '', '', '', '', '', '', '', '' ], [ 'PCB_mass_total', 0.6, 'PCB_cap_mass_film + PCB_cap_mass_SMD + PCB_cap_mass_Tantalum', '', '', '', '', '', '', '', '', '', '', '' ], ['', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['Exchanges', '', '', '', '', '', '', '', '', '', '', '', '', ''], [ 'name', 'amount', 'unit', 'database', 'location', 'type', 'formula', '', '', '', '', '', '', '' ], [ 'unmounted printed circuit board', 0.0, 'square meter', 'PCB', 'GLO', 'technosphere', 'PCB_area * 2', 'PCB_area * 2', '', '', '', '', '', '' ], [ 'mounted printed circuit board', 0.0, 'kilogram', 'PCB', 'GLO', 'production', 'PCB_mass_total', 'PCB_mass_total', '', '', '', '', '', '' ], ['', '', '', '', '', '', '', '', '', '', '', '', '', ''], [ 'Activity', 'unmounted printed circuit board', '', '', '', '', '', '', '', '', '', '', '', '' ], ] ei = ExcelImporter() ei.db_name = 'db' expected = { 'arbitrary': 'metadata', 'comment': 'something important here maybe?', 'database': 'db', 'exchanges': [{ 'database': 'PCB', 'amount': 0.0, 'formula': 'PCB_area * 2', 'location': 'GLO', 'name': 'unmounted printed circuit board', 'type': 'technosphere', 'unit': 'square meter' }, { 'database': 'PCB', 'amount': 0.0, 'formula': 'PCB_mass_total', 'location': 'GLO', 'name': 'mounted printed circuit board', 'type': 'production', 'unit': 'kilogram' }], 'location': 'GLO', 'name': 'mounted printed circuit board', 'parameters': { 'PCB_mass_total': { 'amount': 0.6, 'formula': 'PCB_cap_mass_film + PCB_cap_mass_SMD + PCB_cap_mass_Tantalum' } }, 'type': 'process', 'unit': 'kilogram', 'worksheet name': 'a' } assert ei.get_activity('a', given) == expected
def test_get_activity(no_init): given = [ [ "Activity", "mounted printed circuit board", "", "", "", "", "", "", "", "", "", "", "", "", ], [ "comment", "something important here maybe?", "", "", "", "", "", "", "", "", "", "", "", "", ], [ "arbitrary", "metadata", "", "", "", "", "", "", "", "", "", "", "", "" ], ["location", "GLO", "", "", "", "", "", "", "", "", "", "", "", ""], ["type", "process", "", "", "", "", "", "", "", "", "", "", "", ""], ["unit", "kilogram", "", "", "", "", "", "", "", "", "", "", "", ""], ["", "", "", "", "", "", "", "", "", "", "", "", "", ""], ["Parameters", "", "", "", "", "", "", "", "", "", "", "", "", ""], [ "name", "amount", "formula", "", "", "", "", "", "", "", "", "", "", "" ], [ "PCB_mass_total", 0.6, "PCB_cap_mass_film + PCB_cap_mass_SMD + PCB_cap_mass_Tantalum", "", "", "", "", "", "", "", "", "", "", "", ], ["", "", "", "", "", "", "", "", "", "", "", "", "", ""], ["Exchanges", "", "", "", "", "", "", "", "", "", "", "", "", ""], [ "name", "amount", "unit", "database", "location", "type", "formula", "", "", "", "", "", "", "", ], [ "unmounted printed circuit board", 0.0, "square meter", "PCB", "GLO", "technosphere", "PCB_area * 2", "PCB_area * 2", "", "", "", "", "", "", ], [ "mounted printed circuit board", 0.0, "kilogram", "PCB", "GLO", "production", "PCB_mass_total", "PCB_mass_total", "", "", "", "", "", "", ], ["", "", "", "", "", "", "", "", "", "", "", "", "", ""], [ "Activity", "unmounted printed circuit board", "", "", "", "", "", "", "", "", "", "", "", "", ], ] ei = ExcelImporter() ei.db_name = "db" expected = { "arbitrary": "metadata", "comment": "something important here maybe?", "database": "db", "exchanges": [ { "database": "PCB", "amount": 0.0, "formula": "PCB_area * 2", "location": "GLO", "name": "unmounted printed circuit board", "type": "technosphere", "unit": "square meter", }, { "database": "PCB", "amount": 0.0, "formula": "PCB_mass_total", "location": "GLO", "name": "mounted printed circuit board", "type": "production", "unit": "kilogram", }, ], "location": "GLO", "name": "mounted printed circuit board", "parameters": { "PCB_mass_total": { "amount": 0.6, "formula": "PCB_cap_mass_film + PCB_cap_mass_SMD + PCB_cap_mass_Tantalum", } }, "type": "process", "unit": "kilogram", "worksheet name": "a", } assert ei.get_activity("a", given) == expected
def test_get_activity_metadata_indexing(no_init): given = [ [ 'Activity', 'mounted printed circuit board', '', '', '', '', '', '', '', '', '', '', '', '' ], [ 'arbitrary', 'metadata', '', '', '', '', '', '', '', '', '', '', '', '' ], ['unit', 'kilogram', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['Parameters', '', '', '', '', '', '', '', '', '', '', '', '', ''], ] ei = ExcelImporter() ei.db_name = 'db' expected = { 'arbitrary': 'metadata', 'database': 'db', 'name': 'mounted printed circuit board', 'exchanges': [], 'unit': 'kilogram', 'worksheet name': 'a' } assert ei.get_activity('a', given) == expected given = [ [ 'Activity', 'mounted printed circuit board', '', '', '', '', '', '', '', '', '', '', '', '' ], [ 'arbitrary', 'metadata', '', '', '', '', '', '', '', '', '', '', '', '' ], ['unit', 'kilogram', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', ''], ] ei = ExcelImporter() ei.db_name = 'db' expected = { 'arbitrary': 'metadata', 'database': 'db', 'name': 'mounted printed circuit board', 'exchanges': [], 'unit': 'kilogram', 'worksheet name': 'a' } assert ei.get_activity('a', given) == expected given = [ [ 'Activity', 'mounted printed circuit board', '', '', '', '', '', '', '', '', '', '', '', '' ], [ 'arbitrary', 'metadata', '', '', '', '', '', '', '', '', '', '', '', '' ], ['unit', 'kilogram', '', '', '', '', '', '', '', '', '', '', '', ''], ] ei = ExcelImporter() ei.db_name = 'db' expected = { 'arbitrary': 'metadata', 'database': 'db', 'name': 'mounted printed circuit board', 'exchanges': [], 'unit': 'kilogram', 'worksheet name': 'a' } assert ei.get_activity('a', given) == expected