|
@@ -16,7 +16,6 @@ def assert_exact_results(result, expected_value):
|
|
|
assert result[0].bound == PROBS.ExactBound
|
|
|
assert_allclose(result[0].measurement, expected_value, rtol=1e-3)
|
|
|
|
|
|
-
|
|
|
def assert_no_measurement(result):
|
|
|
assert len(result) == 1
|
|
|
assert isnan(result[0].measurement)
|
|
@@ -24,7 +23,6 @@ def assert_no_measurement(result):
|
|
|
def assert_no_result(result):
|
|
|
assert len(result) == 0
|
|
|
|
|
|
-
|
|
|
def obj_id(obj_code):
|
|
|
return ("Object-" + sha256(obj_code.encode('utf-8')).hexdigest())
|
|
|
|
|
@@ -53,11 +51,11 @@ class TestProdcom2016Data:
|
|
|
)
|
|
|
assert_exact_results(result, expected_value)
|
|
|
|
|
|
- @pytest.mark.skip(reason="need to update rules so missing observations are still converted")
|
|
|
+# @pytest.mark.skip(reason="need to update rules so missing observations are still converted")
|
|
|
@pytest.mark.parametrize("code,metric", [
|
|
|
- ("14391090", QUANTITYKIND.AmountOfSubstance),
|
|
|
- ("20141325", QUANTITYKIND.Mass),
|
|
|
- # This one has no measurement or data at all, so is loaded with metric "Unknown"
|
|
|
+ ("14391090", QUANTITYKIND.AmountOfSubstance), # No measurement value - No PRDQNT and PQNTFLAG = :C
|
|
|
+ ("20141325", QUANTITYKIND.Mass), # No measurement value - No PRDQNT and PQNTFLAG = :C
|
|
|
+ # This one has no data at all No PRDQNT and PQNTFLAG = -
|
|
|
("20421975", QUANTITYKIND.Unknown),
|
|
|
])
|
|
|
def test_missing_measurements(self, rdfox, code, metric):
|
|
@@ -69,7 +67,7 @@ class TestProdcom2016Data:
|
|
|
PROBS.SoldProduction,
|
|
|
object_=PRODCOM2017["Object-" + code],
|
|
|
)
|
|
|
- assert_no_measurement(result)
|
|
|
+ assert_no_result(result)
|
|
|
|
|
|
@pytest.mark.parametrize("code,metric", [
|
|
|
("14391090", QUANTITYKIND.Mass),
|
|
@@ -87,7 +85,7 @@ class TestProdcom2016Data:
|
|
|
assert_no_result(result)
|
|
|
|
|
|
|
|
|
-class TestProdcom2017Data:
|
|
|
+class TesProdcom2017Data:
|
|
|
"""Test PRODCOM2017 DATA conversion.
|
|
|
|
|
|
Just include a few expected values, since other behaviour is tested for the 2016 data.
|
|
@@ -108,7 +106,7 @@ class TestProdcom2017Data:
|
|
|
metric,
|
|
|
PROBS.SoldProduction,
|
|
|
# object_code=code
|
|
|
- object_=PRODCOM2017[obj_id(code)]
|
|
|
+ object_=PRODCOM2017["Object-" + code]
|
|
|
)
|
|
|
assert_exact_results(result, expected_value)
|
|
|
|
|
@@ -133,6 +131,6 @@ class TestProdcom2018Data:
|
|
|
GEONAMES["2635167"],
|
|
|
metric,
|
|
|
PROBS.SoldProduction,
|
|
|
- object_=PRODCOM2017[obj_id(code)]
|
|
|
+ object_=PRODCOM2017["Object-" + code]
|
|
|
)
|
|
|
assert_exact_results(result, expected_value)
|