hestia-earth-models 0.44.6__py3-none-any.whl → 0.44.7__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.

@@ -0,0 +1,75 @@
1
+ from hestia_earth.schema import MeasurementStatsDefinition, MeasurementMethodClassification
2
+ from hestia_earth.utils.model import find_term_match
3
+
4
+ from hestia_earth.models.log import logRequirements, logShouldRun
5
+ from hestia_earth.models.utils.measurement import _new_measurement, group_measurements_by_depth, measurement_value
6
+ from . import MODEL
7
+
8
+ REQUIREMENTS = {
9
+ "Site": {
10
+ "measurements": [
11
+ {"@type": "Measurement", "value": "", "term.@id": "clayContent"},
12
+ {"@type": "Measurement", "value": "", "term.@id": "soilPh"},
13
+ {"@type": "Measurement", "value": "", "term.@id": "organicCarbonPerKgSoil"}
14
+ ]
15
+ }
16
+ }
17
+ RETURNS = {
18
+ "Measurement": [{
19
+ "value": "",
20
+ "depthUpper": "",
21
+ "depthLower": "",
22
+ "statsDefinition": "modelled",
23
+ "methodClassification": "modelled using other physical measurements"
24
+ }]
25
+ }
26
+ TERM_ID = 'cationExchangeCapacityPerKgSoil'
27
+ BIBLIO_TITLE = 'Contribution of Organic Matter and Clay to Soil Cation-Exchange Capacity as Affected by the pH of the Saturating Solution' # noqa: E501
28
+
29
+
30
+ def measurement(value: float, depthUpper: int = None, depthLower: int = None):
31
+ data = _new_measurement(TERM_ID, None, BIBLIO_TITLE)
32
+ data['value'] = [value]
33
+ if depthUpper is not None:
34
+ data['depthUpper'] = depthUpper
35
+ if depthLower is not None:
36
+ data['depthLower'] = depthLower
37
+ data['statsDefinition'] = MeasurementStatsDefinition.MODELLED.value
38
+ data['methodClassification'] = MeasurementMethodClassification.MODELLED_USING_OTHER_PHYSICAL_MEASUREMENTS.value
39
+ return data
40
+
41
+
42
+ def _run(measurements: list):
43
+ clayContent = find_term_match(measurements, 'clayContent')
44
+ clayContent_value = measurement_value(clayContent)
45
+ soilPh = measurement_value(find_term_match(measurements, 'soilPh'))
46
+ organicCarbonPerKgSoil = measurement_value(find_term_match(measurements, 'organicCarbonPerKgSoil'))
47
+
48
+ value = ((51 * soilPh - 59) * (organicCarbonPerKgSoil/10) + (30 + 4.4 * soilPh) * clayContent_value)/100
49
+
50
+ depthUpper = clayContent.get('depthUpper')
51
+ depthLower = clayContent.get('depthLower')
52
+
53
+ return measurement(value, depthUpper=depthUpper, depthLower=depthLower)
54
+
55
+
56
+ def _should_run(site: dict, measurements: list):
57
+ clayContent = find_term_match(measurements, 'clayContent', None)
58
+ soilPh = find_term_match(measurements, 'soilPh', None)
59
+ organicCarbonPerKgSoil = find_term_match(measurements, 'organicCarbonPerKgSoil', None)
60
+
61
+ logRequirements(site, model=MODEL, term=TERM_ID,
62
+ has_clayContent=clayContent is not None,
63
+ has_soilPh=soilPh is not None,
64
+ has_organicCarbonPerKgSoil=organicCarbonPerKgSoil is not None)
65
+
66
+ should_run = all([clayContent is not None, soilPh is not None, organicCarbonPerKgSoil is not None])
67
+ logShouldRun(site, MODEL, TERM_ID, should_run)
68
+ return should_run
69
+
70
+
71
+ def run(site: dict):
72
+ grouped_measurements = list(group_measurements_by_depth(site.get('measurements', [])).values())
73
+ return [
74
+ _run(measurements) for measurements in grouped_measurements if _should_run(site, measurements)
75
+ ]
@@ -0,0 +1,82 @@
1
+ from hestia_earth.schema import MeasurementStatsDefinition, MeasurementMethodClassification
2
+ from hestia_earth.utils.model import find_term_match
3
+
4
+ from hestia_earth.models.log import logRequirements, logShouldRun
5
+ from hestia_earth.models.utils.measurement import _new_measurement, group_measurements_by_depth, measurement_value
6
+ from . import MODEL
7
+
8
+ REQUIREMENTS = {
9
+ "Site": {
10
+ "measurements": [
11
+ {"@type": "Measurement", "value": "", "term.@id": "soilBulkDensity", "depthUpper": "", "depthLower": ""},
12
+ {"@type": "Measurement", "value": "", "term.@id": "organicCarbonPerKgSoil", "depthUpper": "", "depthLower": ""} # noqa: E501
13
+ ]
14
+ }
15
+ }
16
+ RETURNS = {
17
+ "Measurement": [{
18
+ "value": "",
19
+ "depthUpper": "",
20
+ "depthLower": "",
21
+ "statsDefinition": "modelled",
22
+ "methodClassification": "modelled using other physical measurements"
23
+ }]
24
+ }
25
+ TERM_ID = 'organicCarbonPerHa'
26
+ BIBLIO_TITLE = 'Soil organic carbon sequestration rates in vineyard agroecosystems under different soil management practices: A meta-analysis' # noqa: E501
27
+
28
+
29
+ def measurement(value: float, depthUpper: int, depthLower: int):
30
+ data = _new_measurement(TERM_ID, None, BIBLIO_TITLE)
31
+ data['value'] = [value]
32
+ data['depthUpper'] = depthUpper
33
+ data['depthLower'] = depthLower
34
+ data['statsDefinition'] = MeasurementStatsDefinition.MODELLED.value
35
+ data['methodClassification'] = MeasurementMethodClassification.MODELLED_USING_OTHER_PHYSICAL_MEASUREMENTS.value
36
+ return data
37
+
38
+
39
+ def _run(measurements: list):
40
+ soilBulkDensity = measurement_value(find_term_match(measurements, 'soilBulkDensity'))
41
+ organicCarbonPerKgSoil = find_term_match(measurements, 'organicCarbonPerKgSoil')
42
+ organicCarbonPerKgSoil_value = measurement_value(organicCarbonPerKgSoil)
43
+
44
+ value = (
45
+ organicCarbonPerKgSoil.get('depthLower') - organicCarbonPerKgSoil.get('depthUpper')
46
+ ) * soilBulkDensity * (organicCarbonPerKgSoil_value/10) * 1000
47
+
48
+ depthUpper = organicCarbonPerKgSoil.get('depthUpper')
49
+ depthLower = organicCarbonPerKgSoil.get('depthLower')
50
+
51
+ return measurement(value, depthUpper, depthLower)
52
+
53
+
54
+ def _should_run(site: dict, measurements: list):
55
+ soilBulkDensity = find_term_match(measurements, 'soilBulkDensity', None)
56
+ has_soilBulkDensity_depthLower = (soilBulkDensity or {}).get('depthLower') is not None
57
+ has_soilBulkDensity_depthUpper = (soilBulkDensity or {}).get('depthUpper') is not None
58
+ organicCarbonPerKgSoil = find_term_match(measurements, 'organicCarbonPerKgSoil', None)
59
+ has_organicCarbonPerKgSoil_depthLower = (organicCarbonPerKgSoil or {}).get('depthLower') is not None
60
+ has_organicCarbonPerKgSoil_depthUpper = (organicCarbonPerKgSoil or {}).get('depthUpper') is not None
61
+
62
+ logRequirements(site, model=MODEL, term=TERM_ID,
63
+ has_soilBulkDensity=soilBulkDensity is not None,
64
+ has_soilBulkDensity_depthLower=has_soilBulkDensity_depthLower,
65
+ has_soilBulkDensity_depthUpper=has_soilBulkDensity_depthUpper,
66
+ has_organicCarbonPerKgSoil=organicCarbonPerKgSoil is not None,
67
+ has_organicCarbonPerKgSoil_depthLower=has_organicCarbonPerKgSoil_depthLower,
68
+ has_organicCarbonPerKgSoil_depthUpper=has_organicCarbonPerKgSoil_depthUpper)
69
+
70
+ should_run = all([
71
+ soilBulkDensity is not None, has_soilBulkDensity_depthLower, has_soilBulkDensity_depthUpper,
72
+ organicCarbonPerKgSoil is not None, has_organicCarbonPerKgSoil_depthLower, has_organicCarbonPerKgSoil_depthUpper
73
+ ])
74
+ logShouldRun(site, MODEL, TERM_ID, should_run)
75
+ return should_run
76
+
77
+
78
+ def run(site: dict):
79
+ grouped_measurements = list(group_measurements_by_depth(site.get('measurements', [])).values())
80
+ return [
81
+ _run(measurements) for measurements in grouped_measurements if _should_run(site, measurements)
82
+ ]
@@ -1,8 +1,10 @@
1
+ from functools import reduce
1
2
  from dateutil import parser
2
3
  from statistics import mode, mean
3
4
  from hestia_earth.schema import SchemaType
4
5
  from hestia_earth.utils.api import download_hestia
5
6
  from hestia_earth.utils.model import linked_node
7
+ from hestia_earth.utils.tools import non_empty_list
6
8
 
7
9
  from . import _term_id, _include_method, _include_source
8
10
  from .term import get_lookup_value
@@ -59,3 +61,21 @@ def most_relevant_measurement(measurements: list, term_id: str, date: str):
59
61
  def most_relevant_measurement_value(measurements: list, term_id: str, date: str, default=None):
60
62
  measurement = most_relevant_measurement(measurements, term_id, date)
61
63
  return measurement_value(measurement) if measurement else default
64
+
65
+
66
+ def _group_measurement_key(measurement: dict):
67
+ keys = non_empty_list([
68
+ str(measurement.get('depthUpper', '')),
69
+ str(measurement.get('depthLower', '')),
70
+ measurement.get('startDate'),
71
+ measurement.get('endDate')
72
+ ])
73
+ return '-'.join(keys) if len(keys) > 0 else 'default'
74
+
75
+
76
+ def group_measurements_by_depth(measurements: list):
77
+ def group_by(group: dict, measurement: dict):
78
+ key = _group_measurement_key(measurement)
79
+ return group | {key: group.get(key, []) + [measurement]}
80
+
81
+ return reduce(group_by, measurements, {})
@@ -1 +1 @@
1
- VERSION = '0.44.6'
1
+ VERSION = '0.44.7'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hestia-earth-models
3
- Version: 0.44.6
3
+ Version: 0.44.7
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
@@ -2,7 +2,7 @@ hestia_earth/__init__.py,sha256=G-d438vPx7m_ks5e9XTtM3u7LDRO5dSSukibukWmyPM,56
2
2
  hestia_earth/models/__init__.py,sha256=qEFeq3yuf3lQKVseALmL8aPM8fpCS54B_5pry00M3hk,76
3
3
  hestia_earth/models/log.py,sha256=rOgKa-gSrcS-Y1gO9eJXJaA3ofxcQW_45hGly2Lf00Y,2444
4
4
  hestia_earth/models/requirements.py,sha256=znNZJAhwX2iYiKcAQXPftY7z_1MsNa0QxCXkXyHm_U0,17363
5
- hestia_earth/models/version.py,sha256=taeVh2_WgbOJy1VoS9mf7Yd35BQxdqpZcIFdshvWnD0,19
5
+ hestia_earth/models/version.py,sha256=siXWAyoDG_AIMVLULiR25FA-JVP5ErxJNeP4ZVU5pwI,19
6
6
  hestia_earth/models/agribalyse2016/__init__.py,sha256=WvK0qCQbnYtg9oZxrACd1wGormZyXibPtpCnIQeDqbw,415
7
7
  hestia_earth/models/agribalyse2016/fuelElectricity.py,sha256=ztMnY6XTwsJD-lp62jJyzN2AUODvFHIs5d5CaFrlVGI,3567
8
8
  hestia_earth/models/agribalyse2016/machineryInfrastructureDepreciatedAmountPerCycle.py,sha256=10XV1fz_yBYlqmNJ3cxmT2I2Vp_0w7nT4zMIuBw2wCY,3294
@@ -315,7 +315,7 @@ hestia_earth/models/lcImpactCertainEffectsInfinite/damageToTerrestrialEcosystems
315
315
  hestia_earth/models/linkedImpactAssessment/__init__.py,sha256=x6xsPu-Rwh-7HKsvHuKmgM1YML6fQy2z9Hsy9_BeO2Y,3565
316
316
  hestia_earth/models/mocking/__init__.py,sha256=Y39V6yj_3M1q8v9ShCHwPeJOstypOVIvb_FldMEbF7g,766
317
317
  hestia_earth/models/mocking/mock_search.py,sha256=ysPhzvMGvsHKqQXKRFi8ZqohcnyKutBlNqT_j0OH8L4,1983
318
- hestia_earth/models/mocking/search-results.json,sha256=2OtWvfsZjgMVDQHmlMUHZMcsjIu6IaBub8vz492JnQ4,29411
318
+ hestia_earth/models/mocking/search-results.json,sha256=OxONqG0icjhfpsx9abPt-4FQDnOD2OQFHJot1eJNX_8,29671
319
319
  hestia_earth/models/pooreNemecek2018/__init__.py,sha256=nPboL7ULJzL5nJD5q7q9VOZt_fxbKVm8fmn1Az5YkVY,417
320
320
  hestia_earth/models/pooreNemecek2018/aboveGroundCropResidueTotal.py,sha256=trQBxjc8V77q96sxvK4Y9HfpD64zgyGuB5o5_o0lHts,2189
321
321
  hestia_earth/models/pooreNemecek2018/belowGroundCropResidue.py,sha256=do9zHHR8VuqFcWNLnql5t3tV478SCVc7tC3mEs5cdUk,2184
@@ -401,8 +401,10 @@ hestia_earth/models/schererPfister2015/pToGroundwaterSoilFlux.py,sha256=Gt3YdTCu
401
401
  hestia_earth/models/schererPfister2015/pToSurfaceWaterSoilFlux.py,sha256=bzgtCAtX0D5cRqoL24Ukg2IDr00Up7Ji4m1QQ9fJ-9w,2741
402
402
  hestia_earth/models/schererPfister2015/utils.py,sha256=LEvz9guqto0kuF5rXcQjgYsD3CvEmORvJQqRA1f7uMI,3130
403
403
  hestia_earth/models/site/__init__.py,sha256=aQRep10EVnCIY97xAxTFQ_AFJNNoZtPvb50mIu_HmQo,342
404
+ hestia_earth/models/site/cationExchangeCapacityPerKgSoil.py,sha256=TOc5u1r0-wOXjdmNunz0QErexNRQc2n9i3fMykvFu60,3153
404
405
  hestia_earth/models/site/flowingWater.py,sha256=ZPeXd2tNYgG24kYOGQZM9lrUzCi9nZsabvHJsaH0hy4,1796
405
406
  hestia_earth/models/site/netPrimaryProduction.py,sha256=mwoQcjYkCbHxzZ8PhFN7RtjwKa5igqkICpNVJq08lYc,1901
407
+ hestia_earth/models/site/organicCarbonPerHa.py,sha256=_duLpVHx-rx0f1I5IzreDp9LulC0JULrX63bm2W_tcM,3905
406
408
  hestia_earth/models/site/organicCarbonPerKgSoil.py,sha256=zY9QUho9jhaQK-X0x_DszZOoj-Ol8NzNcASk-Ix_qEk,1870
407
409
  hestia_earth/models/site/organicCarbonPerM3Soil.py,sha256=r-rDBLr-h10__csvlWreoe2MVBpMT5MMmokZVLRJ7Iw,1870
408
410
  hestia_earth/models/site/organicMatterPerKgSoil.py,sha256=VXXLt9lBWkNR8xY4tGOi9DmiaRBKydbevwJ_HL2JNf0,1870
@@ -464,7 +466,7 @@ hestia_earth/models/utils/inorganicFertiliser.py,sha256=zJpNvDNaEsZ2T_V4APAQy4rm
464
466
  hestia_earth/models/utils/input.py,sha256=CsoMC_Jjnifl5mjPWhWOBhiHmNI5IGWRfPjshOV1Ipg,6798
465
467
  hestia_earth/models/utils/liveAnimal.py,sha256=u_Lym0hVinncCZMYF_KscCA3vuelWmlyHn4I-jVRDs4,1505
466
468
  hestia_earth/models/utils/lookup.py,sha256=Y9ekB_AGpmZKZI7NnYodvvF2pFHlkFHkryMk1SVWp60,5307
467
- hestia_earth/models/utils/measurement.py,sha256=jeX82DPwVQHFBMe5V0yGvQEDDv4ymMtiMsMbOwgM9oU,2607
469
+ hestia_earth/models/utils/measurement.py,sha256=FPH1yPOztLe2J5dwGbrHMDFiEPe7aBVYKHvRUY8Cd2c,3266
468
470
  hestia_earth/models/utils/pesticideAI.py,sha256=KQNXos2oG-TbDARxg3ksJAfAAYeiaQIZ5e3V2S0A-fA,1329
469
471
  hestia_earth/models/utils/practice.py,sha256=tNadOzsrNlCEt801B815XaruJXzZ5yPASam7B3sWpXE,1091
470
472
  hestia_earth/models/utils/product.py,sha256=OFzxe2mFdqUfhQ7tfXkhd-sYMqIxPLIgKJFq65oNrQE,8605
@@ -860,8 +862,10 @@ tests/models/schererPfister2015/test_pToDrainageWaterSoilFlux.py,sha256=57MVRyiE
860
862
  tests/models/schererPfister2015/test_pToGroundwaterSoilFlux.py,sha256=lOTL-ue6hEbQsKIss6VsN7bJME5UCB3pTbqbLtMp9rk,1064
861
863
  tests/models/schererPfister2015/test_pToSurfaceWaterSoilFlux.py,sha256=1VJo9q-Kb2OboK2RMp3-bkP6lXfkFbqMz1ACJC75FWw,1441
862
864
  tests/models/site/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
865
+ tests/models/site/test_cationExchangeCapacityPerKgSoil.py,sha256=FOtllJ_E4Ld4MngPn__CsQXXeHhZ5fNB-ruSd8DUgFQ,963
863
866
  tests/models/site/test_flowingWater.py,sha256=q7ktHV7sffIUBf0SgIhbkL_U_c7RTHYv6oWhXY4A6io,1274
864
867
  tests/models/site/test_netPrimaryProduction.py,sha256=FaC5TEwHnR56_QrXkIB5u3mgSLOcSmBRbL8vzqaZwk0,1056
868
+ tests/models/site/test_organicCarbonPerHa.py,sha256=m392fH_aEt_tI6dVhAzOVHKpeuztNgP5p6yNiLTs4Mw,983
865
869
  tests/models/site/test_organicCarbonPerKgSoil.py,sha256=fqPe2JbrZwwMK497Qnb2WPx4-n2vda4PW-S3tQa_CGI,1035
866
870
  tests/models/site/test_organicCarbonPerM3Soil.py,sha256=8fOwtcBAFH1fSduIXXtYOdL83oYAVxC4f6BAZpY5X_w,1035
867
871
  tests/models/site/test_organicMatterPerKgSoil.py,sha256=EvZ6HknxjUjhdmdYostB9eCc_WowpRWpmssWM2vT_NU,1035
@@ -921,8 +925,8 @@ tests/models/utils/test_site.py,sha256=deEIYptl2MHEklSfHbZV9qA59YKqZLQr8y5rWYiD4
921
925
  tests/models/utils/test_term.py,sha256=-Wn2C1jyOLfkvhcKmKWT-Jms7yqLwx5ok91gYJNcGWc,2028
922
926
  tests/models/webbEtAl2012AndSintermannEtAl2012/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
923
927
  tests/models/webbEtAl2012AndSintermannEtAl2012/test_nh3ToAirOrganicFertiliser.py,sha256=qi2FNXS5Af2WDtm7nq_FsprH3BfCF0XxnE0XHmC4aIY,2244
924
- hestia_earth_models-0.44.6.dist-info/LICENSE,sha256=EFSZhfUdZCTsCIYdHzTGewMKfRfp7X9t1s2aaKxm8O0,1154
925
- hestia_earth_models-0.44.6.dist-info/METADATA,sha256=sZ1RfX1WGhbTlTP_40S7dwt1QBruRa52MSpOWiZmD-w,3192
926
- hestia_earth_models-0.44.6.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
927
- hestia_earth_models-0.44.6.dist-info/top_level.txt,sha256=1dqA9TqpOLTEgpqa-YBsmbCmmNU1y56AtfFGEceZ2A0,19
928
- hestia_earth_models-0.44.6.dist-info/RECORD,,
928
+ hestia_earth_models-0.44.7.dist-info/LICENSE,sha256=EFSZhfUdZCTsCIYdHzTGewMKfRfp7X9t1s2aaKxm8O0,1154
929
+ hestia_earth_models-0.44.7.dist-info/METADATA,sha256=FVLQ7WFHs3bn6q2b2j-Dzjanz9_fRIlt1fL2ms6MBsM,3192
930
+ hestia_earth_models-0.44.7.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
931
+ hestia_earth_models-0.44.7.dist-info/top_level.txt,sha256=1dqA9TqpOLTEgpqa-YBsmbCmmNU1y56AtfFGEceZ2A0,19
932
+ hestia_earth_models-0.44.7.dist-info/RECORD,,
@@ -0,0 +1,31 @@
1
+ from unittest.mock import patch
2
+ import json
3
+ from tests.utils import fixtures_path, fake_new_measurement
4
+
5
+ from hestia_earth.models.site.cationExchangeCapacityPerKgSoil import MODEL, TERM_ID, run, _should_run
6
+
7
+ class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
8
+ fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
9
+
10
+
11
+ @patch(f"{class_path}.find_term_match")
12
+ def test_should_run(mock_find):
13
+ # no measurement => no run
14
+ mock_find.return_value = None
15
+ assert not _should_run({}, [])
16
+
17
+ # with measurement => run
18
+ mock_find.return_value = {'value': [10]}
19
+ assert _should_run({}, []) is True
20
+
21
+
22
+ @patch(f"{class_path}._new_measurement", side_effect=fake_new_measurement)
23
+ def test_run(*args):
24
+ with open(f"{fixtures_folder}/site.jsonld", encoding='utf-8') as f:
25
+ site = json.load(f)
26
+
27
+ with open(f"{fixtures_folder}/result.jsonld", encoding='utf-8') as f:
28
+ expected = json.load(f)
29
+
30
+ value = run(site)
31
+ assert value == expected
@@ -0,0 +1,31 @@
1
+ from unittest.mock import patch
2
+ import json
3
+ from tests.utils import fixtures_path, fake_new_measurement
4
+
5
+ from hestia_earth.models.site.organicCarbonPerHa import MODEL, TERM_ID, run, _should_run
6
+
7
+ class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
8
+ fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
9
+
10
+
11
+ @patch(f"{class_path}.find_term_match")
12
+ def test_should_run(mock_find):
13
+ # no measurement => no run
14
+ mock_find.return_value = {}
15
+ assert not _should_run({}, [])
16
+
17
+ # with measurement => run
18
+ mock_find.return_value = {'value': [10], 'depthUpper': 0, 'depthLower': 10}
19
+ assert _should_run({}, []) is True
20
+
21
+
22
+ @patch(f"{class_path}._new_measurement", side_effect=fake_new_measurement)
23
+ def test_run(*args):
24
+ with open(f"{fixtures_folder}/site.jsonld", encoding='utf-8') as f:
25
+ site = json.load(f)
26
+
27
+ with open(f"{fixtures_folder}/result.jsonld", encoding='utf-8') as f:
28
+ expected = json.load(f)
29
+
30
+ value = run(site)
31
+ assert value == expected