hestia-earth-models 0.73.4__py3-none-any.whl → 0.73.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of hestia-earth-models might be problematic. Click here for more details.
- hestia_earth/models/config/Site.json +11 -0
- hestia_earth/models/hestia/landCover.py +51 -5
- hestia_earth/models/ipcc2019/biocharOrganicCarbonPerHa.py +435 -0
- hestia_earth/models/mocking/search-results.json +699 -695
- hestia_earth/models/version.py +1 -1
- {hestia_earth_models-0.73.4.dist-info → hestia_earth_models-0.73.5.dist-info}/METADATA +1 -1
- {hestia_earth_models-0.73.4.dist-info → hestia_earth_models-0.73.5.dist-info}/RECORD +12 -10
- tests/models/hestia/test_landCover.py +33 -1
- tests/models/ipcc2019/test_biocharOrganicCarbonPerHa.py +131 -0
- {hestia_earth_models-0.73.4.dist-info → hestia_earth_models-0.73.5.dist-info}/LICENSE +0 -0
- {hestia_earth_models-0.73.4.dist-info → hestia_earth_models-0.73.5.dist-info}/WHEEL +0 -0
- {hestia_earth_models-0.73.4.dist-info → hestia_earth_models-0.73.5.dist-info}/top_level.txt +0 -0
hestia_earth/models/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
VERSION = '0.73.
|
|
1
|
+
VERSION = '0.73.5'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: hestia-earth-models
|
|
3
|
-
Version: 0.73.
|
|
3
|
+
Version: 0.73.5
|
|
4
4
|
Summary: HESTIA's set of modules for filling gaps in the activity data using external datasets (e.g. populating soil properties with a geospatial dataset using provided coordinates) and internal lookups (e.g. populating machinery use from fuel use). Includes rules for when gaps should be filled versus not (e.g. never gap fill yield, gap fill crop residue if yield provided etc.).
|
|
5
5
|
Home-page: https://gitlab.com/hestia-earth/hestia-engine-models
|
|
6
6
|
Author: HESTIA Team
|
|
@@ -5,7 +5,7 @@ hestia_earth/models/cache_sites.py,sha256=XpXnkYt823PQzrswgP__L4CT8xZG_n7a41CIHK
|
|
|
5
5
|
hestia_earth/models/log.py,sha256=eRuH86v7Thuw-QXdKqaqVmA_MkwnOCo0UBEwtuDq4Oc,3554
|
|
6
6
|
hestia_earth/models/preload_requests.py,sha256=vK_G1UzhNMhYy7ymnCtHUz_vv3cfApCSKqv29VREEBQ,1943
|
|
7
7
|
hestia_earth/models/requirements.py,sha256=eU4yT443fx7BnaokhrLB_PCizJI7Y6m4auyo8vQauNg,17363
|
|
8
|
-
hestia_earth/models/version.py,sha256=
|
|
8
|
+
hestia_earth/models/version.py,sha256=gaJ7asOZglEOu1WEQGhDLAicifIKNkt5PDb2Cw4T0-8,19
|
|
9
9
|
hestia_earth/models/agribalyse2016/__init__.py,sha256=WvK0qCQbnYtg9oZxrACd1wGormZyXibPtpCnIQeDqbw,415
|
|
10
10
|
hestia_earth/models/agribalyse2016/fuelElectricity.py,sha256=1ngl8pdxeNhlVV8keAeWRwGorr_1uFXM9EoPUWx-uSc,4382
|
|
11
11
|
hestia_earth/models/agribalyse2016/machineryInfrastructureDepreciatedAmountPerCycle.py,sha256=queToXuzq0tQ9_XuUJ2pJgSywXmbt9uX3ZoIKgqkROM,2660
|
|
@@ -37,7 +37,7 @@ hestia_earth/models/cml2001NonBaseline/eutrophicationPotentialIncludingFateAvera
|
|
|
37
37
|
hestia_earth/models/cml2001NonBaseline/terrestrialAcidificationPotentialExcludingFate.py,sha256=xcrxfs9UoV_EWvV-XzMt35oPWCUsTzqg2SGA3j2MFIw,1091
|
|
38
38
|
hestia_earth/models/config/Cycle.json,sha256=3fsz2dNEKA4noEjqrp25Or3_scDxqFS7c_7v911Gpno,59078
|
|
39
39
|
hestia_earth/models/config/ImpactAssessment.json,sha256=ubAHJRHOFdX-fIYkOEBuD0CYvNZtFYSr8GSgKliVL8g,60968
|
|
40
|
-
hestia_earth/models/config/Site.json,sha256=
|
|
40
|
+
hestia_earth/models/config/Site.json,sha256=4DPSziHnDIngyub3Of8OvDEKa446q3Yx48R2Eobqk24,14374
|
|
41
41
|
hestia_earth/models/config/__init__.py,sha256=l1WqL7ezlank86ABP4zUia_hIvM9ba-sOE3z6wNrea8,2333
|
|
42
42
|
hestia_earth/models/config/run-calculations.json,sha256=e3nJ4M6CP1iFzfv8ou_ZUFbFxYkDxJgwuNDXTm4PBDc,615
|
|
43
43
|
hestia_earth/models/config/trigger-calculations.json,sha256=3dmn2bRuj6QEtSTOLdIy31ho7thgUXyDsnqZzPV9rAQ,623
|
|
@@ -205,7 +205,7 @@ hestia_earth/models/hestia/freshWater.py,sha256=Q-dmFJLZfyYEyFyYkJUOjgmQR3G5YXCX
|
|
|
205
205
|
hestia_earth/models/hestia/histosol.py,sha256=IexiWTSlSJYGjrdpYmRooW6v8LjhYATPQ8smMz1UZBA,1612
|
|
206
206
|
hestia_earth/models/hestia/inorganicFertiliser.py,sha256=We4PBaTXyGwEQTfhX0-J8Xt03p-FB9i9j3tEK5JQ8uE,9026
|
|
207
207
|
hestia_earth/models/hestia/irrigatedTypeUnspecified.py,sha256=VdYzfYxcRzWv21qxRkDn9HBid7-Bt_CgIv4iyXJH03g,1929
|
|
208
|
-
hestia_earth/models/hestia/landCover.py,sha256=
|
|
208
|
+
hestia_earth/models/hestia/landCover.py,sha256=l0uhIxHZ9cD8ZB37RzeWUzjfh7d0iTB7GiMG7DYWddU,34937
|
|
209
209
|
hestia_earth/models/hestia/landTransformation100YearAverageDuringCycle.py,sha256=hF7_DDvrs7swH6ott_ihgYx13UzEKHH6pccYCtzrN8o,1069
|
|
210
210
|
hestia_earth/models/hestia/landTransformation20YearAverageDuringCycle.py,sha256=05SCH6ZjEV3mIleRusBg677zu0xgu5YK0f9FCddgNPg,1067
|
|
211
211
|
hestia_earth/models/hestia/liveAnimal.py,sha256=d7HuUi40c-7TN1kecdRuqbht8PAe7x4ps0NhSuWG34Q,3868
|
|
@@ -287,6 +287,7 @@ hestia_earth/models/ipcc2019/aboveGroundBiomass.py,sha256=T50NcJoyGrHYUSzJBXJKAO
|
|
|
287
287
|
hestia_earth/models/ipcc2019/aboveGroundCropResidueTotal.py,sha256=lT2QVV5c2LvQqZRfPEvFT_bMTayMXgIsFLnx8I6iYzw,3089
|
|
288
288
|
hestia_earth/models/ipcc2019/belowGroundBiomass.py,sha256=WN3R5kUIc5Ij4HxMFcTGKeNRoPChRY6ws0x3nQNeEMw,19421
|
|
289
289
|
hestia_earth/models/ipcc2019/belowGroundCropResidue.py,sha256=qbfsLBPaMIt4oQzYAzbsZdkJozTbwuztNr48TLYC5-Y,3507
|
|
290
|
+
hestia_earth/models/ipcc2019/biocharOrganicCarbonPerHa.py,sha256=--qSO-v0X6qlti5NmUD5bcjGpf4tX352vPVDU0ECAI0,13276
|
|
290
291
|
hestia_earth/models/ipcc2019/biomass_utils.py,sha256=NkTPGMl-0tqvhUZKZ1rxW0XTBnZOvgFJki_IPzEEyu0,15796
|
|
291
292
|
hestia_earth/models/ipcc2019/carbonContent.py,sha256=XhXDu6DRQxANBsRsCEgw4f0UJDOgWsvhVyEwK1-4YT0,7263
|
|
292
293
|
hestia_earth/models/ipcc2019/ch4ToAirAquacultureSystems.py,sha256=JeyF4tUPn3KIDbXwgM_MFp18hnTZjLBBqMFMH_ciZ1Q,3529
|
|
@@ -448,7 +449,7 @@ hestia_earth/models/linkedImpactAssessment/utils.py,sha256=7M-E7u35fIF0uMoA1hwcr
|
|
|
448
449
|
hestia_earth/models/mocking/__init__.py,sha256=9VX50c-grz-snfd-7MBS0KfF7AadtbKuj7kK6PqtsgE,687
|
|
449
450
|
hestia_earth/models/mocking/build_mock_search.py,sha256=p15ccEUmkmLp1RiGNznxMz3OFHbI8P1-29ExuohiQN8,1355
|
|
450
451
|
hestia_earth/models/mocking/mock_search.py,sha256=ccFe_WrI73JElFmxp4hPNLCX7eeU--lBC1JFR901KJY,1069
|
|
451
|
-
hestia_earth/models/mocking/search-results.json,sha256=
|
|
452
|
+
hestia_earth/models/mocking/search-results.json,sha256=eMTxqv2Lz6tZuSuUkOWRnBLsqPIp7JIoupRI3YyIrig,162691
|
|
452
453
|
hestia_earth/models/pooreNemecek2018/__init__.py,sha256=nPboL7ULJzL5nJD5q7q9VOZt_fxbKVm8fmn1Az5YkVY,417
|
|
453
454
|
hestia_earth/models/pooreNemecek2018/aboveGroundCropResidueTotal.py,sha256=oXillpppAas1q9GKmODxe1YXyno3EzV-j12xhzkqtTc,2404
|
|
454
455
|
hestia_earth/models/pooreNemecek2018/belowGroundCropResidue.py,sha256=_pQMPSvI--Xm00H6vXDA4ct_pQXKRGrLE2f-2tQE6y4,2323
|
|
@@ -844,7 +845,7 @@ tests/models/hestia/test_freshWater.py,sha256=v2UD69csKrniKP3MXkOEHxQeE6O3-lvIVi
|
|
|
844
845
|
tests/models/hestia/test_histosol.py,sha256=7g-3wQPZok2O8mExcnKZxO_T2Ye_h3UHv3HG3Kn8orM,888
|
|
845
846
|
tests/models/hestia/test_inorganicFertiliser.py,sha256=v2Zs1Ig-ChOaq9gXuurcBt12izkH2bRUUuzW6rh3rqQ,643
|
|
846
847
|
tests/models/hestia/test_irrigatedTypeUnspecified.py,sha256=bluZADFagxfXW4QyI0CIJzG97D2V33w333Z9Vwjqo0M,2015
|
|
847
|
-
tests/models/hestia/test_landCover.py,sha256=
|
|
848
|
+
tests/models/hestia/test_landCover.py,sha256=rGJq9WtaAOKYmUA_sLRHyHZgxo2heoODpB9Jo7jC9Pc,9076
|
|
848
849
|
tests/models/hestia/test_landTransformation100YearAverageDuringCycle.py,sha256=3qa4rWUFqP1VM5-vm_182rhiBYJDxPqJwWtBqJ5K028,956
|
|
849
850
|
tests/models/hestia/test_landTransformation20YearAverageDuringCycle.py,sha256=bUByojQuVeuCfko1_2YtNJi1PT9yktHlcbPi_p-MPvk,1001
|
|
850
851
|
tests/models/hestia/test_liveAnimal.py,sha256=3K9cL1fwr6LlBl1_D8zIaeCOuiExqkDEU7BXx1JK_dk,2139
|
|
@@ -919,6 +920,7 @@ tests/models/ipcc2019/test_aboveGroundBiomass.py,sha256=zzsE1zr8qYWgc1EWNrCZggjk
|
|
|
919
920
|
tests/models/ipcc2019/test_aboveGroundCropResidueTotal.py,sha256=HrTsqm1r5c5di5JONu7P4_95JMp1kbDuKfQjWLE0Jhs,2573
|
|
920
921
|
tests/models/ipcc2019/test_belowGroundBiomass.py,sha256=Cu41RM63R-xti0qi_mLD0J5TClo61OkjsR4FI3caNxs,7579
|
|
921
922
|
tests/models/ipcc2019/test_belowGroundCropResidue.py,sha256=no71pfxgOhn_tEWc_EwuWvlKRtHFqlIqNIvnP7cj0Tc,2568
|
|
923
|
+
tests/models/ipcc2019/test_biocharOrganicCarbonPerHa.py,sha256=19SX8sCKjyqThydHBh7jE9S46Y6SBd-pJx_RUmuZ0nU,3785
|
|
922
924
|
tests/models/ipcc2019/test_biomass_utils.py,sha256=I2q4pDGAD0aY_kpZCMPJoC-KbRYxdzY1rhr4xtJFWIA,3592
|
|
923
925
|
tests/models/ipcc2019/test_carbonContent.py,sha256=_GWF5nGy-PxiqBZ5V7W_sHMz75YRzmxr79R-sZZg7yk,4146
|
|
924
926
|
tests/models/ipcc2019/test_ch4ToAirAquacultureSystems.py,sha256=hG1zunH2gCeix8fxxkoGfl_I0GRyAcLbwEtwWVE9i5M,1925
|
|
@@ -1249,8 +1251,8 @@ tests/orchestrator/strategies/run/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeR
|
|
|
1249
1251
|
tests/orchestrator/strategies/run/test_add_blank_node_if_missing.py,sha256=K4xg4UAXfNhSaLyknKVPO7MGBF44Z_gD7CuZ_pe28gU,3512
|
|
1250
1252
|
tests/orchestrator/strategies/run/test_add_key_if_missing.py,sha256=hKwvk1ohcBVnQUCTiDhRW99J0xEa29BpwFi1KC0yWLE,329
|
|
1251
1253
|
tests/orchestrator/strategies/run/test_always.py,sha256=w5-Dhp6yLzgZGAeMRz3OrqZbbAed9gZ1O266a3z9k7w,134
|
|
1252
|
-
hestia_earth_models-0.73.
|
|
1253
|
-
hestia_earth_models-0.73.
|
|
1254
|
-
hestia_earth_models-0.73.
|
|
1255
|
-
hestia_earth_models-0.73.
|
|
1256
|
-
hestia_earth_models-0.73.
|
|
1254
|
+
hestia_earth_models-0.73.5.dist-info/LICENSE,sha256=TD25LoiRJsA5CPUNrcyt1PXlGcbUGFMAeZoBcfCrCNE,1154
|
|
1255
|
+
hestia_earth_models-0.73.5.dist-info/METADATA,sha256=waCb4T4IfTXsSP5YtJg9ac3PfcnmIDejSOW2sgFDf4I,4065
|
|
1256
|
+
hestia_earth_models-0.73.5.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
1257
|
+
hestia_earth_models-0.73.5.dist-info/top_level.txt,sha256=1dqA9TqpOLTEgpqa-YBsmbCmmNU1y56AtfFGEceZ2A0,19
|
|
1258
|
+
hestia_earth_models-0.73.5.dist-info/RECORD,,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import logging
|
|
1
2
|
import os
|
|
2
3
|
import json
|
|
3
4
|
import pytest
|
|
@@ -13,7 +14,10 @@ from hestia_earth.models.hestia.landCover import (
|
|
|
13
14
|
|
|
14
15
|
CLASS_PATH = f"hestia_earth.models.{MODEL}.{MODEL_KEY}"
|
|
15
16
|
fixtures_folder = f"{fixtures_path}/{MODEL}/{MODEL_KEY}"
|
|
16
|
-
_folders = [
|
|
17
|
+
_folders = [
|
|
18
|
+
d for d in os.listdir(fixtures_folder)
|
|
19
|
+
if os.path.isdir(os.path.join(fixtures_folder, d)) and not d.startswith("_")
|
|
20
|
+
]
|
|
17
21
|
|
|
18
22
|
FAOSTAT_CLASS_PATH = f"hestia_earth.models.{FAOSTAT_MODEL}.utils"
|
|
19
23
|
faostat_fixtures_folder = f"{fixtures_path}/{FAOSTAT_MODEL}/utils"
|
|
@@ -254,3 +258,31 @@ def test_run(mock, subfolder: str):
|
|
|
254
258
|
|
|
255
259
|
result = run(site)
|
|
256
260
|
assert result == expected
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
def fake_region_lookup(lookup_name: str, term_id: str, column: str, **log_args):
|
|
264
|
+
"""Returns obviously-wrong mock results from Brazil to be distinct from model."""
|
|
265
|
+
return ("2010:55.0")
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
@patch(f"{CLASS_PATH}.get_region_lookup_value", side_effect=fake_region_lookup)
|
|
269
|
+
@patch(f"{CLASS_PATH}._new_management", side_effect=fake_new_management)
|
|
270
|
+
def test_landCover_from_lookup_run(mock_mgmt, mock_region_lookup, caplog):
|
|
271
|
+
caplog.set_level(logging.INFO)
|
|
272
|
+
folder = f"{fixtures_folder}/_from_lookups"
|
|
273
|
+
with open(f"{folder}/site.jsonld", encoding='utf-8') as f:
|
|
274
|
+
site = json.load(f)
|
|
275
|
+
|
|
276
|
+
with open(f"{folder}/result.jsonld", encoding='utf-8') as f:
|
|
277
|
+
expected = json.load(f)
|
|
278
|
+
|
|
279
|
+
result = run(site)
|
|
280
|
+
expected_message = ("site=Brazil-example, requirements=true, model=hestia, model_key=landCover, "
|
|
281
|
+
"has_management_nodes=True, land_use_type=Arable land, allowed_land_use_types=Arable land;"
|
|
282
|
+
"Permanent crops;Permanent meadows and pastures, has_no_prior_land_cover_data=True, "
|
|
283
|
+
"management_nodes=value:100_id:maizePlant_land-use-type:Arable land_endDate:2010-12-31"
|
|
284
|
+
"_startDate:2010-01-01, landCover_from_lookups={'Forest land': 0.55, 'Arable land': 0.55, "
|
|
285
|
+
"'Permanent crops': 0.55, 'Permanent meadows and pastures': 0.55, 'Other land': 0.55}, "
|
|
286
|
+
"should_run_nodes=True")
|
|
287
|
+
assert expected_message in [r.msg for r in caplog.records]
|
|
288
|
+
assert result == expected
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from os.path import isfile
|
|
3
|
+
from pytest import mark
|
|
4
|
+
from unittest.mock import MagicMock, patch
|
|
5
|
+
|
|
6
|
+
from hestia_earth.models.ipcc2019.biocharOrganicCarbonPerHa import _should_run, MODEL, run, TERM_ID
|
|
7
|
+
|
|
8
|
+
from tests.utils import fake_new_measurement, fixtures_path
|
|
9
|
+
|
|
10
|
+
class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
|
|
11
|
+
property_path = "hestia_earth.models.utils.property"
|
|
12
|
+
fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
|
|
13
|
+
|
|
14
|
+
_DEFAULT_PROPERTIES = {
|
|
15
|
+
"biocharManureGasification": {
|
|
16
|
+
"organicCarbonContent": {
|
|
17
|
+
"value": 9,
|
|
18
|
+
"sd": 2.4,
|
|
19
|
+
"min": 0,
|
|
20
|
+
"max": 100
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"biocharBambooLowTemperaturePyrolysis": {
|
|
24
|
+
"organicCarbonContent": {
|
|
25
|
+
"value": 77,
|
|
26
|
+
"sd": 16.5,
|
|
27
|
+
"min": 0,
|
|
28
|
+
"max": 100
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"biocharStrawHighTemperaturePyrolysis": {
|
|
32
|
+
"organicCarbonContent": {
|
|
33
|
+
"value": 65,
|
|
34
|
+
"sd": 14.9,
|
|
35
|
+
"min": 0,
|
|
36
|
+
"max": 100
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"biocharPaperSludgeMediumTemperaturePyrolysis": {
|
|
40
|
+
"organicCarbonContent": {
|
|
41
|
+
"value": 35,
|
|
42
|
+
"sd": 7.1,
|
|
43
|
+
"min": 0,
|
|
44
|
+
"max": 100
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"biocharUnspecifiedFeedstockUnspecifiedProductionMethod": {
|
|
48
|
+
"organicCarbonContent": {
|
|
49
|
+
"value": 40.6,
|
|
50
|
+
"sd": 10.5,
|
|
51
|
+
"min": 0,
|
|
52
|
+
"max": 100
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def fake_find_term_property(term: dict, property: str, *_):
|
|
59
|
+
term_id = term.get('@id', None)
|
|
60
|
+
return _DEFAULT_PROPERTIES.get(term_id, {}).get(property, {})
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _load_fixture(path: str, default=None):
|
|
64
|
+
if isfile(path):
|
|
65
|
+
with open(path, encoding="utf-8") as f:
|
|
66
|
+
return json.load(f)
|
|
67
|
+
return default
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
# subfolder, should_run
|
|
71
|
+
PARAMS_SHOULD_RUN = [
|
|
72
|
+
("with-stats", True),
|
|
73
|
+
("no-biochar", True),
|
|
74
|
+
("no-cycles", False),
|
|
75
|
+
("with-organic-soils", False),
|
|
76
|
+
("with-relative-func-unit", False),
|
|
77
|
+
("with-site-type-forest", False)
|
|
78
|
+
]
|
|
79
|
+
IDS_SHOULD_RUN = [p[0] for p in PARAMS_SHOULD_RUN]
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
@mark.parametrize("subfolder, should_run", PARAMS_SHOULD_RUN, ids=IDS_SHOULD_RUN)
|
|
83
|
+
@patch(f"{property_path}.find_term_property", side_effect=fake_find_term_property)
|
|
84
|
+
@patch(f"{property_path}.download_term")
|
|
85
|
+
@patch(f"{class_path}.related_cycles")
|
|
86
|
+
def test_should_run(
|
|
87
|
+
related_cycles_mock: MagicMock,
|
|
88
|
+
download_term_mock: MagicMock,
|
|
89
|
+
_find_term_property_mock: MagicMock,
|
|
90
|
+
subfolder: str,
|
|
91
|
+
should_run: bool
|
|
92
|
+
):
|
|
93
|
+
folder = f"{fixtures_folder}/{subfolder}"
|
|
94
|
+
|
|
95
|
+
site = _load_fixture(f"{folder}/site.jsonld", {})
|
|
96
|
+
related_cycles_mock.return_value = _load_fixture(f"{folder}/cycles.jsonld", [])
|
|
97
|
+
|
|
98
|
+
result, *_ = _should_run(site)
|
|
99
|
+
assert result == should_run
|
|
100
|
+
|
|
101
|
+
# Ensure that the property utils are properly mocked.
|
|
102
|
+
download_term_mock.assert_not_called()
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
PARAMS_RUN = [subfolder for subfolder, should_run in PARAMS_SHOULD_RUN if should_run]
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
@mark.parametrize("subfolder", PARAMS_RUN)
|
|
109
|
+
@patch(f"{property_path}.find_term_property", side_effect=fake_find_term_property)
|
|
110
|
+
@patch(f"{property_path}.download_term")
|
|
111
|
+
@patch(f"{class_path}.related_cycles")
|
|
112
|
+
@patch(f"{class_path}._new_measurement", side_effect=fake_new_measurement)
|
|
113
|
+
def test_run(
|
|
114
|
+
_new_measurement_mock: MagicMock,
|
|
115
|
+
related_cycles_mock: MagicMock,
|
|
116
|
+
download_term_mock: MagicMock,
|
|
117
|
+
_find_term_property_mock: MagicMock,
|
|
118
|
+
subfolder: str
|
|
119
|
+
):
|
|
120
|
+
folder = f"{fixtures_folder}/{subfolder}"
|
|
121
|
+
|
|
122
|
+
site = _load_fixture(f"{folder}/site.jsonld", {})
|
|
123
|
+
related_cycles_mock.return_value = _load_fixture(f"{folder}/cycles.jsonld", [])
|
|
124
|
+
|
|
125
|
+
expected = _load_fixture(f"{folder}/result.jsonld", [])
|
|
126
|
+
|
|
127
|
+
result = run(site)
|
|
128
|
+
assert result == expected
|
|
129
|
+
|
|
130
|
+
# Ensure that the property utils are properly mocked.
|
|
131
|
+
download_term_mock.assert_not_called()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|