Skip to content

Commit

Permalink
Test updates
Browse files Browse the repository at this point in the history
  • Loading branch information
cmutel committed Oct 13, 2024
1 parent 4e74cc9 commit 16208ec
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions tests/csv/csv_lcia.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions tests/excel/lcia.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
1 change: 1 addition & 0 deletions tests/export/csv_excel_exporters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 7 additions & 6 deletions tests/sentier.dev/test_simapro_units.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}
Expand Down

0 comments on commit 16208ec

Please sign in to comment.