-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
168 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,42 @@ | ||
# import unittest | ||
import unittest | ||
|
||
# from bw2io.compatibility import SIMAPRO_BIO_SUBCATEGORIES, SIMAPRO_BIOSPHERE | ||
# from bw2io.strategies.simapro import ( | ||
# normalize_simapro_biosphere_categories, | ||
# normalize_simapro_biosphere_names, | ||
# ) | ||
from bw2io.compatibility import SIMAPRO_BIO_SUBCATEGORIES, SIMAPRO_BIOSPHERE | ||
from bw2io.strategies.simapro import ( | ||
normalize_simapro_biosphere_categories, | ||
normalize_simapro_biosphere_names, | ||
) | ||
|
||
|
||
# class SPNormalizationTestCase(unittest.TestCase): | ||
# def test_sp_biosphere_category_normalization(self): | ||
# db = [ | ||
# { | ||
# "exchanges": [ | ||
# {"categories": ["Economic issues", "foo"], "type": "biosphere"}, | ||
# {"categories": ["Resources", "high. pop."], "type": "biosphere"}, | ||
# { | ||
# "categories": ["Economic issues", "high. pop."], | ||
# "type": "not biosphere", | ||
# }, | ||
# ], | ||
# } | ||
# ] | ||
# result = [ | ||
# { | ||
# "exchanges": [ | ||
# {"categories": ("economic", "foo"), "type": "biosphere"}, | ||
# { | ||
# "categories": ("natural resource", "urban air close to ground"), | ||
# "type": "biosphere", | ||
# }, | ||
# { | ||
# "categories": ["Economic issues", "high. pop."], | ||
# "type": "not biosphere", | ||
# }, | ||
# ], | ||
# } | ||
# ] | ||
# self.assertEqual( | ||
# result, | ||
# normalize_simapro_biosphere_categories(db), | ||
# ) | ||
class SPNormalizationTestCase(unittest.TestCase): | ||
def test_sp_biosphere_category_normalization(self): | ||
db = [ | ||
{ | ||
"exchanges": [ | ||
{"categories": ["Economic issues", "foo"], "type": "biosphere"}, | ||
{"categories": ["Resources", "high. pop."], "type": "biosphere"}, | ||
{ | ||
"categories": ["Economic issues", "high. pop."], | ||
"type": "not biosphere", | ||
}, | ||
], | ||
} | ||
] | ||
result = [ | ||
{ | ||
"exchanges": [ | ||
{"categories": ("economic", "foo"), "type": "biosphere"}, | ||
{ | ||
"categories": ("natural resource", "urban air close to ground"), | ||
"type": "biosphere", | ||
}, | ||
{ | ||
"categories": ["Economic issues", "high. pop."], | ||
"type": "not biosphere", | ||
}, | ||
], | ||
} | ||
] | ||
self.assertEqual( | ||
result, | ||
normalize_simapro_biosphere_categories(db), | ||
) |