From 16208ec69dcba9a6953811c92fbdfd346f7d816e Mon Sep 17 00:00:00 2001 From: Chris Mutel Date: Sun, 13 Oct 2024 22:59:39 +0200 Subject: [PATCH] Test updates --- tests/csv/csv_lcia.py | 4 ++-- tests/excel/lcia.py | 4 ++-- tests/export/csv_excel_exporters.py | 1 + tests/sentier.dev/test_simapro_units.py | 13 +++++++------ 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/tests/csv/csv_lcia.py b/tests/csv/csv_lcia.py index cf9af4fa..cca768df 100644 --- a/tests/csv/csv_lcia.py +++ b/tests/csv/csv_lcia.py @@ -1,6 +1,6 @@ import os -from bw2data import Database, Method, config, methods +from bw2data import Database, Method, config, methods, get_node from bw2data.tests import bw2test from bw2io import CSVLCIAImporter @@ -79,5 +79,5 @@ def test_csv_lcia_integration(): } assert methods[("foo",)] == expected - expected = [(("biosphere", "a"), 42), (("biosphere", "b"), 1000000)] + expected = [(get_node(code="a").id, 42), (get_node(code="b").id, 1000000)] assert Method(("foo",)).load() == expected diff --git a/tests/excel/lcia.py b/tests/excel/lcia.py index d9f23bc4..38c8b713 100644 --- a/tests/excel/lcia.py +++ b/tests/excel/lcia.py @@ -1,6 +1,6 @@ import os -from bw2data import Database, Method, config, methods +from bw2data import Database, Method, config, methods, get_node from bw2data.tests import bw2test from bw2io import ExcelLCIAImporter @@ -81,5 +81,5 @@ def test_excel_lcia_integration(): } assert methods[("foo",)] == expected - expected = [(("biosphere", "a"), 42), (("biosphere", "b"), 1000000)] + expected = [(get_node(code="a").id, 42), (get_node(code="b").id, 1000000)] assert Method(("foo",)).load() == expected diff --git a/tests/export/csv_excel_exporters.py b/tests/export/csv_excel_exporters.py index c89d10b8..77d5970f 100644 --- a/tests/export/csv_excel_exporters.py +++ b/tests/export/csv_excel_exporters.py @@ -124,6 +124,7 @@ def test_write_lci_excel_rich_data_skipped(): [None, None], ["Activity", "bar"], ["code", "a"], + ['type', 'processwithreferenceproduct'], ["Exchanges", None], ] assert given == expected diff --git a/tests/sentier.dev/test_simapro_units.py b/tests/sentier.dev/test_simapro_units.py index db33136c..3b545453 100644 --- a/tests/sentier.dev/test_simapro_units.py +++ b/tests/sentier.dev/test_simapro_units.py @@ -11,38 +11,39 @@ def test_integration_SPUC(): result = spuc.get_simapro_conversions("MJ") expected = [ { - "qk": "https://vocab.sentier.dev/qudt/quantity-kind/Energy", + "qk": "https://vocab.sentier.dev/units/quantity-kind/Energy", "factor": 0.001, "unit": "GJ", }, { - "qk": "https://vocab.sentier.dev/qudt/quantity-kind/Energy", + "qk": "https://vocab.sentier.dev/units/quantity-kind/Energy", "factor": 1000.0, "unit": "kJ", }, { - "qk": "https://vocab.sentier.dev/qudt/quantity-kind/Energy", + "qk": "https://vocab.sentier.dev/units/quantity-kind/Energy", "factor": 0.2777777777777778, "unit": "kWh", }, { - "qk": "https://vocab.sentier.dev/qudt/quantity-kind/Energy", + "qk": "https://vocab.sentier.dev/units/quantity-kind/Energy", "factor": 0.0002777777777777778, "unit": "MWh", }, { - "qk": "https://vocab.sentier.dev/qudt/quantity-kind/Energy", + "qk": "https://vocab.sentier.dev/units/quantity-kind/Energy", "factor": 277.77777777777777, "unit": "Wh", }, ] + print(result) for obj in expected: assert obj in result result = spuc.get_simapro_conversions("km") expected = [ { - "qk": "https://vocab.sentier.dev/qudt/quantity-kind/Length", + "qk": "https://vocab.sentier.dev/units/quantity-kind/Length", "factor": 1000.0, "unit": "m", }