|
@@ -25,16 +25,13 @@ def assert_no_result(result):
|
|
|
assert len(result) == 0
|
|
|
|
|
|
|
|
|
-def obj_id(obj_code):
|
|
|
- return ("Object-" + sha256(obj_code.encode('utf-8')).hexdigest())
|
|
|
-
|
|
|
-
|
|
|
# Do most tests for 2016; then spot check a few values for the other years
|
|
|
|
|
|
class TestProdcom2016Data:
|
|
|
"""Test PRODCOM2016 DATA conversion"""
|
|
|
|
|
|
- endpoint_data = ["outputs/total_production/DS-056121_006-2016.nt.gz"]
|
|
|
+ endpoint_data = ["outputs/total_production/DS-056121_006-2016.nt.gz",
|
|
|
+ "outputs/PRD_2017_20200617_185035.nt.gz"]
|
|
|
|
|
|
@pytest.mark.parametrize("code,metric,expected_value", [
|
|
|
("13103100", QUANTITYKIND.Mass, 224299),
|
|
@@ -49,7 +46,7 @@ class TestProdcom2016Data:
|
|
|
GEONAMES["2635167"],
|
|
|
metric,
|
|
|
PROBS.TotalProduction,
|
|
|
- object_=PRODCOM2017["Object-" + code]
|
|
|
+ object_code=code
|
|
|
)
|
|
|
assert_exact_results(result, expected_value)
|
|
|
|
|
@@ -64,10 +61,9 @@ class TestProdcom2016Data:
|
|
|
GEONAMES["2635167"] ,
|
|
|
metric,
|
|
|
PROBS.TotalProduction,
|
|
|
- object_=PRODCOM2017["Object-" + code],
|
|
|
+ object_code=code,
|
|
|
)
|
|
|
assert_no_result(result)
|
|
|
- print(PRODCOM2017[obj_id(code)])
|
|
|
|
|
|
@pytest.mark.parametrize("code,metric", [
|
|
|
("13201230", QUANTITYKIND.Mass),
|
|
@@ -80,7 +76,7 @@ class TestProdcom2016Data:
|
|
|
GEONAMES["2635167"] ,
|
|
|
metric,
|
|
|
PROBS.TotalProduction,
|
|
|
- object_=PRODCOM2017["Object-" + code],
|
|
|
+ object_code=code,
|
|
|
)
|
|
|
assert_no_result(result)
|
|
|
|
|
@@ -91,7 +87,8 @@ class TestProdcom2017Data:
|
|
|
Just include a few expected values, since other behaviour is tested for the 2016 data.
|
|
|
"""
|
|
|
|
|
|
- endpoint_data = ["outputs/total_production/DS-056121_006-2017.nt.gz"]
|
|
|
+ endpoint_data = ["outputs/total_production/DS-056121_006-2017.nt.gz",
|
|
|
+ "outputs/PRD_2017_20200617_185035.nt.gz"]
|
|
|
|
|
|
@pytest.mark.parametrize("code,metric,expected_value", [
|
|
|
("08111250", QUANTITYKIND.Mass, 604132000),
|
|
@@ -105,7 +102,7 @@ class TestProdcom2017Data:
|
|
|
GEONAMES["2635167"],
|
|
|
metric,
|
|
|
PROBS.TotalProduction,
|
|
|
- object_=PRODCOM2017["Object-" + code]
|
|
|
+ object_code=code
|
|
|
)
|
|
|
assert_exact_results(result, expected_value)
|
|
|
|
|
@@ -116,7 +113,8 @@ class TestProdcom2018Data:
|
|
|
Just include a few expected values, since other behaviour is tested for the 2016 data.
|
|
|
"""
|
|
|
|
|
|
- endpoint_data = ["outputs/total_production/DS-056121_006-2018.nt.gz"]
|
|
|
+ endpoint_data = ["outputs/total_production/DS-056121_006-2018.nt.gz",
|
|
|
+ "outputs/PRD_2017_20200617_185035.nt.gz"]
|
|
|
|
|
|
@pytest.mark.parametrize("code,metric,expected_value", [
|
|
|
("08114000", QUANTITYKIND.Mass, 41455000),
|
|
@@ -130,6 +128,6 @@ class TestProdcom2018Data:
|
|
|
GEONAMES["2635167"],
|
|
|
metric,
|
|
|
PROBS.TotalProduction,
|
|
|
- object_=PRODCOM2017["Object-" + code]
|
|
|
+ object_code=code
|
|
|
)
|
|
|
assert_exact_results(result, expected_value)
|