Skip to content

Commit

Permalink
Fix #282
Browse files Browse the repository at this point in the history
  • Loading branch information
cmutel committed Nov 27, 2024
1 parent 388cf86 commit b6c217b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
9 changes: 3 additions & 6 deletions bw2io/extractors/ecospold2.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,12 +575,9 @@ def extract_exchange(cls, exc):
"type": kind,
"name": exc.name.text,
"classifications": {
"CPC": [
o.classificationValue.text
for o in exc.iterchildren()
if "classification" in o.tag
and o.classificationSystem.text == "CPC"
]
o.classificationSystem.text: o.classificationValue.text
for o in exc.iterchildren()
if o.tag == "{http://www.EcoInvent.org/EcoSpold02}classification"
},
"production volume": float(exc.get("productionVolumeAmount") or 0),
"properties": cls.extract_properties(exc),
Expand Down
16 changes: 10 additions & 6 deletions tests/ecospold2/ecospold2_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ def test_extraction_without_synonyms():
"type": "technosphere",
"name": "clay pit infrastructure",
"classifications": {
"CPC": ["53269: Other constructions for manufacturing"]
"By-product classification": "allocatable product",
"CPC": "53269: Other constructions for manufacturing",
},
"production volume": 0.0,
"properties": {},
Expand All @@ -54,7 +55,8 @@ def test_extraction_without_synonyms():
"type": "production",
"name": "concrete block",
"classifications": {
"CPC": ["37510: Non-refractory mortars and concretes"]
"By-product classification": "allocatable product",
"CPC": "37510: Non-refractory mortars and concretes",
},
"production volume": 42.0,
"properties": {
Expand Down Expand Up @@ -84,7 +86,7 @@ def test_extraction_without_synonyms():
"CAS number": "7732-18-5",
"variable name": "it_is_boring_to_do_this_manually",
"name": "Water",
"classifications": {"CPC": []},
"classifications": {},
"production volume": 0.0,
"properties": {
"water in wet mass": {
Expand Down Expand Up @@ -166,7 +168,8 @@ def test_extraction_with_synonyms():
"type": "technosphere",
"name": "clay pit infrastructure",
"classifications": {
"CPC": ["53269: Other constructions for manufacturing"]
"By-product classification": "allocatable product",
"CPC": "53269: Other constructions for manufacturing",
},
"production volume": 0.0,
"properties": {},
Expand All @@ -191,7 +194,8 @@ def test_extraction_with_synonyms():
"type": "production",
"name": "concrete block",
"classifications": {
"CPC": ["37510: Non-refractory mortars and concretes"]
"By-product classification": "allocatable product",
"CPC": "37510: Non-refractory mortars and concretes",
},
"production volume": 42.0,
"properties": {
Expand Down Expand Up @@ -220,8 +224,8 @@ def test_extraction_with_synonyms():
"chemical formula": "h2o2",
"formula": "does_it_hurt_when_dropped_on_foot * 2",
"CAS number": "7732-18-5",
"classifications": {},
"variable name": "it_is_boring_to_do_this_manually",
"classifications": {"CPC": []},
"production volume": 0.0,
"properties": {
"water in wet mass": {
Expand Down

0 comments on commit b6c217b

Please sign in to comment.