hestia-earth-models 0.69.1__py3-none-any.whl → 0.70.1__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.
Files changed (219) hide show
  1. hestia_earth/models/aware/scarcityWeightedWaterUse.py +8 -16
  2. hestia_earth/models/cache_sites.py +3 -2
  3. hestia_earth/models/cml2001Baseline/abioticResourceDepletionFossilFuels.py +2 -1
  4. hestia_earth/models/cml2001Baseline/abioticResourceDepletionMineralsAndMetals.py +3 -2
  5. hestia_earth/models/config/Cycle.json +82 -60
  6. hestia_earth/models/config/ImpactAssessment.json +12 -4
  7. hestia_earth/models/config/Site.json +33 -22
  8. hestia_earth/models/cycle/animal/input/hestiaAggregatedData.py +1 -1
  9. hestia_earth/models/cycle/animal/input/properties.py +1 -1
  10. hestia_earth/models/cycle/cycleDuration.py +2 -2
  11. hestia_earth/models/cycle/input/hestiaAggregatedData.py +12 -14
  12. hestia_earth/models/cycle/input/properties.py +1 -1
  13. hestia_earth/models/cycle/siteDuration.py +3 -3
  14. hestia_earth/models/cycle/transformation.py +1 -1
  15. hestia_earth/models/cycle/utils.py +0 -6
  16. hestia_earth/models/data/ecoinventV3/__init__.py +15 -13
  17. hestia_earth/models/ecoalimV9/__init__.py +13 -0
  18. hestia_earth/models/ecoalimV9/cycle.py +128 -0
  19. hestia_earth/models/ecoalimV9/impact_assessment.py +125 -0
  20. hestia_earth/models/ecoalimV9/utils.py +31 -0
  21. hestia_earth/models/ecoinventV3/__init__.py +6 -14
  22. hestia_earth/models/ecoinventV3/utils.py +1 -29
  23. hestia_earth/models/ecoinventV3AndEmberClimate/__init__.py +8 -2
  24. hestia_earth/models/emissionNotRelevant/__init__.py +33 -8
  25. hestia_earth/models/frischknechtEtAl2000/ionisingRadiationKbqU235Eq.py +1 -1
  26. hestia_earth/models/geospatialDatabase/croppingIntensity.py +4 -4
  27. hestia_earth/models/geospatialDatabase/longFallowRatio.py +4 -4
  28. hestia_earth/models/geospatialDatabase/region.py +3 -2
  29. hestia_earth/models/geospatialDatabase/utils.py +6 -5
  30. hestia_earth/models/haversineFormula/transport/distance.py +5 -4
  31. hestia_earth/models/{koble2014 → hestia}/aboveGroundCropResidue.py +4 -5
  32. hestia_earth/models/{cycle → hestia}/aboveGroundCropResidueTotal.py +2 -2
  33. hestia_earth/models/{site → hestia}/brackishWater.py +1 -1
  34. hestia_earth/models/{site → hestia}/cationExchangeCapacityPerKgSoil.py +1 -1
  35. hestia_earth/models/{cycle → hestia}/coldCarcassWeightPerHead.py +1 -1
  36. hestia_earth/models/{cycle → hestia}/coldDressedCarcassWeightPerHead.py +1 -1
  37. hestia_earth/models/{cycle → hestia}/concentrateFeed.py +1 -1
  38. hestia_earth/models/{cycle → hestia}/cropResidueManagement.py +1 -1
  39. hestia_earth/models/{cycle → hestia}/croppingIntensity.py +1 -1
  40. hestia_earth/models/{cycle → hestia}/energyContentLowerHeatingValue.py +2 -2
  41. hestia_earth/models/{cycle → hestia}/excretaKgMass.py +7 -2
  42. hestia_earth/models/{cycle → hestia}/excretaKgN.py +1 -1
  43. hestia_earth/models/{cycle → hestia}/excretaKgVs.py +1 -1
  44. hestia_earth/models/{cycle → hestia}/feedConversionRatio/__init__.py +1 -1
  45. hestia_earth/models/{site → hestia}/flowingWater.py +1 -1
  46. hestia_earth/models/{site → hestia}/freshWater.py +1 -1
  47. hestia_earth/models/{cycle → hestia}/inorganicFertiliser.py +1 -1
  48. hestia_earth/models/{cycle → hestia}/irrigatedTypeUnspecified.py +14 -19
  49. hestia_earth/models/hestia/landCover.py +31 -27
  50. hestia_earth/models/hestia/landTransformation100YearAverageDuringCycle.py +2 -1
  51. hestia_earth/models/hestia/landTransformation20YearAverageDuringCycle.py +2 -1
  52. hestia_earth/models/{cycle → hestia}/liveAnimal.py +1 -1
  53. hestia_earth/models/{cycle → hestia}/longFallowRatio.py +1 -1
  54. hestia_earth/models/{site → hestia}/management.py +5 -3
  55. hestia_earth/models/{cycle → hestia}/materialAndSubstrate.py +1 -1
  56. hestia_earth/models/{cycle → hestia}/milkYield.py +1 -1
  57. hestia_earth/models/{site → hestia}/netPrimaryProduction.py +1 -1
  58. hestia_earth/models/{site → hestia}/organicCarbonPerHa.py +1 -1
  59. hestia_earth/models/{cycle → hestia}/pastureGrass.py +1 -1
  60. hestia_earth/models/{cycle → hestia}/pastureSystem.py +1 -1
  61. hestia_earth/models/{site → hestia}/potentialEvapotranspirationAnnual.py +3 -3
  62. hestia_earth/models/{site → hestia}/potentialEvapotranspirationMonthly.py +3 -3
  63. hestia_earth/models/{site → hestia}/precipitationAnnual.py +3 -3
  64. hestia_earth/models/{site → hestia}/precipitationMonthly.py +3 -3
  65. hestia_earth/models/{site → hestia}/rainfallAnnual.py +3 -3
  66. hestia_earth/models/{site → hestia}/rainfallMonthly.py +3 -3
  67. hestia_earth/models/{cycle → hestia}/readyToCookWeightPerHead.py +1 -1
  68. hestia_earth/models/{cycle → hestia}/residueBurnt.py +1 -1
  69. hestia_earth/models/{cycle → hestia}/residueIncorporated.py +1 -1
  70. hestia_earth/models/{cycle → hestia}/residueLeftOnField.py +1 -1
  71. hestia_earth/models/hestia/residueRemoved.py +65 -13
  72. hestia_earth/models/{site → hestia}/salineWater.py +1 -1
  73. hestia_earth/models/hestia/seed_emissions.py +1 -1
  74. hestia_earth/models/{site → hestia}/soilMeasurement.py +1 -1
  75. hestia_earth/models/{cycle → hestia}/stockingDensityAnimalHousingAverage.py +1 -1
  76. hestia_earth/models/{site → hestia}/temperatureAnnual.py +3 -3
  77. hestia_earth/models/{site → hestia}/temperatureMonthly.py +3 -3
  78. hestia_earth/models/{site → hestia}/totalNitrogenPerKgSoil.py +1 -1
  79. hestia_earth/models/{cycle → hestia}/unknownPreSeasonWaterRegime.py +1 -1
  80. hestia_earth/models/hestia/utils.py +93 -0
  81. hestia_earth/models/{site → hestia}/waterDepth.py +1 -1
  82. hestia_earth/models/hestia/waterSalinity.py +78 -0
  83. hestia_earth/models/impact_assessment/emissions.py +1 -1
  84. hestia_earth/models/impact_assessment/product/economicValueShare.py +1 -1
  85. hestia_earth/models/impact_assessment/product/value.py +1 -1
  86. hestia_earth/models/ipcc2019/aboveGroundBiomass.py +1 -1
  87. hestia_earth/models/ipcc2019/animal/fatContent.py +2 -2
  88. hestia_earth/models/ipcc2019/animal/milkYieldPerAnimal.py +2 -2
  89. hestia_earth/models/ipcc2019/animal/trueProteinContent.py +2 -2
  90. hestia_earth/models/ipcc2019/belowGroundBiomass.py +1 -1
  91. hestia_earth/models/ipcc2019/biomass_utils.py +2 -4
  92. hestia_earth/models/ipcc2019/ch4ToAirEntericFermentation.py +7 -2
  93. hestia_earth/models/ipcc2019/ch4ToAirFloodedRice.py +163 -78
  94. hestia_earth/models/ipcc2019/co2ToAirAboveGroundBiomassStockChange.py +1 -0
  95. hestia_earth/models/ipcc2019/co2ToAirBelowGroundBiomassStockChange.py +2 -1
  96. hestia_earth/models/ipcc2019/co2ToAirCarbonStockChange_utils.py +31 -20
  97. hestia_earth/models/ipcc2019/co2ToAirSoilOrganicCarbonStockChange.py +2 -1
  98. hestia_earth/models/ipcc2019/co2ToAirUreaHydrolysis.py +16 -9
  99. hestia_earth/models/ipcc2019/nonCo2EmissionsToAirNaturalVegetationBurning.py +36 -47
  100. hestia_earth/models/ipcc2019/organicCarbonPerHa_tier_1.py +94 -9
  101. hestia_earth/models/ipcc2019/organicCarbonPerHa_tier_2.py +167 -13
  102. hestia_earth/models/ipcc2019/organicCarbonPerHa_utils.py +7 -5
  103. hestia_earth/models/koble2014/cropResidueManagement.py +1 -1
  104. hestia_earth/models/koble2014/residueBurnt.py +1 -1
  105. hestia_earth/models/koble2014/residueRemoved.py +1 -1
  106. hestia_earth/models/koble2014/utils.py +3 -3
  107. hestia_earth/models/mocking/search-results.json +1263 -1229
  108. hestia_earth/models/pooreNemecek2018/excretaKgN.py +1 -1
  109. hestia_earth/models/pooreNemecek2018/freshwaterWithdrawalsDuringCycle.py +1 -1
  110. hestia_earth/models/pooreNemecek2018/utils.py +12 -3
  111. hestia_earth/models/schmidt2007/ch4ToAirWasteTreatment.py +1 -6
  112. hestia_earth/models/schmidt2007/h2SToAirWasteTreatment.py +1 -6
  113. hestia_earth/models/schmidt2007/n2OToAirWasteTreatmentDirect.py +1 -6
  114. hestia_earth/models/schmidt2007/nh3ToAirWasteTreatment.py +1 -6
  115. hestia_earth/models/site/pre_checks/country.py +4 -2
  116. hestia_earth/models/transformation/input/excreta.py +1 -1
  117. hestia_earth/models/utils/aggregated.py +12 -15
  118. hestia_earth/models/utils/background_emissions.py +52 -0
  119. hestia_earth/models/utils/blank_node.py +24 -6
  120. hestia_earth/models/utils/impact_assessment.py +26 -17
  121. hestia_earth/models/utils/lookup.py +48 -39
  122. hestia_earth/models/utils/measurement.py +3 -3
  123. hestia_earth/models/utils/product.py +1 -1
  124. hestia_earth/models/utils/source.py +2 -1
  125. hestia_earth/models/utils/term.py +26 -1
  126. hestia_earth/models/version.py +1 -1
  127. {hestia_earth_models-0.69.1.dist-info → hestia_earth_models-0.70.1.dist-info}/METADATA +2 -2
  128. {hestia_earth_models-0.69.1.dist-info → hestia_earth_models-0.70.1.dist-info}/RECORD +214 -209
  129. tests/models/aware/test_scarcityWeightedWaterUse.py +1 -12
  130. tests/models/cycle/input/test_hestiaAggregatedData.py +18 -16
  131. tests/models/ecoalimV9/__init__.py +0 -0
  132. tests/models/ecoalimV9/test_cycle.py +21 -0
  133. tests/models/ecoalimV9/test_impact_assessment.py +24 -0
  134. tests/models/environmentalFootprintV3_1/test_scarcityWeightedWaterUse.py +4 -2
  135. tests/models/geospatialDatabase/test_region.py +1 -1
  136. tests/models/geospatialDatabase/test_utils.py +1 -1
  137. tests/models/haversineFormula/transport/test_distance.py +2 -2
  138. tests/models/{koble2014 → hestia}/test_aboveGroundCropResidue.py +3 -3
  139. tests/models/{cycle → hestia}/test_aboveGroundCropResidueTotal.py +1 -1
  140. tests/models/{site → hestia}/test_brackishWater.py +1 -1
  141. tests/models/{site → hestia}/test_cationExchangeCapacityPerKgSoil.py +1 -1
  142. tests/models/{cycle → hestia}/test_coldCarcassWeightPerHead.py +1 -1
  143. tests/models/{cycle → hestia}/test_coldDressedCarcassWeightPerHead.py +1 -1
  144. tests/models/{cycle → hestia}/test_concentrateFeed.py +1 -1
  145. tests/models/{cycle → hestia}/test_cropResidueManagement.py +1 -1
  146. tests/models/{cycle → hestia}/test_croppingIntensity.py +1 -1
  147. tests/models/{cycle → hestia}/test_energyContentLowerHeatingValue.py +5 -3
  148. tests/models/{cycle → hestia}/test_excretaKgMass.py +1 -1
  149. tests/models/{cycle → hestia}/test_excretaKgN.py +1 -1
  150. tests/models/{cycle → hestia}/test_excretaKgVs.py +1 -1
  151. tests/models/{cycle → hestia}/test_feedConversionRatio.py +1 -1
  152. tests/models/{site → hestia}/test_flowingWater.py +1 -1
  153. tests/models/{site → hestia}/test_freshWater.py +1 -1
  154. tests/models/{cycle → hestia}/test_inorganicFertiliser.py +1 -1
  155. tests/models/{cycle → hestia}/test_irrigatedTypeUnspecified.py +2 -5
  156. tests/models/hestia/test_landCover.py +4 -34
  157. tests/models/{cycle → hestia}/test_liveAnimal.py +1 -1
  158. tests/models/{cycle → hestia}/test_longFallowRatio.py +1 -1
  159. tests/models/{site → hestia}/test_management.py +1 -1
  160. tests/models/{cycle → hestia}/test_materialsAndSubstrate.py +1 -1
  161. tests/models/{cycle → hestia}/test_milkYield.py +1 -1
  162. tests/models/{site → hestia}/test_netPrimaryProduction.py +1 -1
  163. tests/models/{site → hestia}/test_organicCarbonPerHa.py +1 -1
  164. tests/models/{site → hestia}/test_organicCarbonPerKgSoil.py +1 -1
  165. tests/models/{site → hestia}/test_organicCarbonPerM3Soil.py +1 -1
  166. tests/models/{site → hestia}/test_organicMatterPerKgSoil.py +1 -1
  167. tests/models/{site → hestia}/test_organicMatterPerM3Soil.py +1 -1
  168. tests/models/{cycle → hestia}/test_pastureGrass.py +1 -1
  169. tests/models/{cycle → hestia}/test_pastureSystem.py +1 -1
  170. tests/models/{site → hestia}/test_potentialEvapotranspirationAnnual.py +1 -1
  171. tests/models/{site → hestia}/test_potentialEvapotranspirationMonthly.py +1 -1
  172. tests/models/{site → hestia}/test_precipitationAnnual.py +1 -1
  173. tests/models/{site → hestia}/test_precipitationMonthly.py +1 -1
  174. tests/models/{site → hestia}/test_rainfallAnnual.py +1 -1
  175. tests/models/{site → hestia}/test_rainfallMonthly.py +1 -1
  176. tests/models/{cycle → hestia}/test_readyToCookWeightPerHead.py +1 -1
  177. tests/models/{cycle → hestia}/test_residueBurnt.py +1 -1
  178. tests/models/{cycle → hestia}/test_residueIncorporated.py +1 -1
  179. tests/models/{cycle → hestia}/test_residueLeftOnField.py +1 -1
  180. tests/models/hestia/test_residueRemoved.py +15 -3
  181. tests/models/{site → hestia}/test_salineWater.py +1 -1
  182. tests/models/{site → hestia}/test_soilMeasurement.py +2 -2
  183. tests/models/{cycle → hestia}/test_stockingDensityAnimalHousingAverage.py +1 -1
  184. tests/models/{site → hestia}/test_temperatureAnnual.py +1 -1
  185. tests/models/{site → hestia}/test_temperatureMonthly.py +1 -1
  186. tests/models/{site → hestia}/test_totalNitrogenPerKgSoil.py +1 -1
  187. tests/models/{cycle → hestia}/test_unknownPreSeasonWaterRegime.py +1 -1
  188. tests/models/{site → hestia}/test_waterDepth.py +1 -1
  189. tests/models/hestia/test_waterSalinity.py +26 -0
  190. tests/models/ipcc2019/test_ch4ToAirEntericFermentation.py +11 -0
  191. tests/models/ipcc2019/test_ch4ToAirFloodedRice.py +10 -42
  192. tests/models/ipcc2019/test_co2ToAirSoilOrganicCarbonStockChange.py +2 -1
  193. tests/models/ipcc2019/test_nonCo2EmissionsToAirNaturalVegetationBurning.py +22 -8
  194. tests/models/ipcc2019/test_organicCarbonPerHa.py +4 -2
  195. tests/models/pooreNemecek2018/test_landOccupationDuringCycle.py +3 -0
  196. tests/models/site/pre_checks/test_country.py +4 -3
  197. tests/models/test_ecoinventV3.py +2 -2
  198. tests/models/test_ecoinventV3AndEmberClimate.py +2 -2
  199. tests/models/test_emissionNotRelevant.py +0 -8
  200. tests/models/utils/test_measurement.py +1 -1
  201. tests/models/utils/test_source.py +15 -5
  202. tests/orchestrator/test_models.py +1 -0
  203. hestia_earth/models/cycle/residueRemoved.py +0 -54
  204. hestia_earth/models/hestia/nh3ToSurfaceWaterAquacultureSystems.py +0 -64
  205. hestia_earth/models/site/utils.py +0 -93
  206. tests/models/cycle/test_residueRemoved.py +0 -37
  207. tests/models/hestia/test_nh3ToSurfaceWaterAquacultureSystems.py +0 -51
  208. /hestia_earth/models/{cycle → hestia}/feedConversionRatio/feedConversionRatioCarbon.py +0 -0
  209. /hestia_earth/models/{cycle → hestia}/feedConversionRatio/feedConversionRatioDryMatter.py +0 -0
  210. /hestia_earth/models/{cycle → hestia}/feedConversionRatio/feedConversionRatioEnergy.py +0 -0
  211. /hestia_earth/models/{cycle → hestia}/feedConversionRatio/feedConversionRatioFedWeight.py +0 -0
  212. /hestia_earth/models/{cycle → hestia}/feedConversionRatio/feedConversionRatioNitrogen.py +0 -0
  213. /hestia_earth/models/{site → hestia}/organicCarbonPerKgSoil.py +0 -0
  214. /hestia_earth/models/{site → hestia}/organicCarbonPerM3Soil.py +0 -0
  215. /hestia_earth/models/{site → hestia}/organicMatterPerKgSoil.py +0 -0
  216. /hestia_earth/models/{site → hestia}/organicMatterPerM3Soil.py +0 -0
  217. {hestia_earth_models-0.69.1.dist-info → hestia_earth_models-0.70.1.dist-info}/LICENSE +0 -0
  218. {hestia_earth_models-0.69.1.dist-info → hestia_earth_models-0.70.1.dist-info}/WHEEL +0 -0
  219. {hestia_earth_models-0.69.1.dist-info → hestia_earth_models-0.70.1.dist-info}/top_level.txt +0 -0
@@ -2,7 +2,7 @@ from unittest.mock import patch
2
2
  import json
3
3
  from tests.utils import fixtures_path, fake_new_measurement
4
4
 
5
- from hestia_earth.models.site.precipitationMonthly import MODEL, TERM_ID, run, _should_run
5
+ from hestia_earth.models.hestia.precipitationMonthly import MODEL, TERM_ID, run, _should_run
6
6
 
7
7
  class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
8
8
  fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
@@ -2,7 +2,7 @@ from unittest.mock import patch
2
2
  import json
3
3
  from tests.utils import fixtures_path, fake_new_measurement
4
4
 
5
- from hestia_earth.models.site.rainfallAnnual import MODEL, TERM_ID, run, _should_run
5
+ from hestia_earth.models.hestia.rainfallAnnual import MODEL, TERM_ID, run, _should_run
6
6
 
7
7
  class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
8
8
  fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
@@ -2,7 +2,7 @@ from unittest.mock import patch
2
2
  import json
3
3
  from tests.utils import fixtures_path, fake_new_measurement
4
4
 
5
- from hestia_earth.models.site.rainfallMonthly import MODEL, TERM_ID, run, _should_run
5
+ from hestia_earth.models.hestia.rainfallMonthly import MODEL, TERM_ID, run, _should_run
6
6
 
7
7
  class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
8
8
  fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
@@ -4,7 +4,7 @@ import json
4
4
  from hestia_earth.schema import TermTermType
5
5
  from tests.utils import fixtures_path, fake_new_property
6
6
 
7
- from hestia_earth.models.cycle.readyToCookWeightPerHead import MODEL, TERM_ID, _should_run, run
7
+ from hestia_earth.models.hestia.readyToCookWeightPerHead import MODEL, TERM_ID, _should_run, run
8
8
 
9
9
  class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
10
10
  fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
@@ -2,7 +2,7 @@ from unittest.mock import patch
2
2
  import json
3
3
  from tests.utils import fake_new_practice, fixtures_path
4
4
 
5
- from hestia_earth.models.cycle.residueBurnt import MODEL, TERM_ID, _should_run, run
5
+ from hestia_earth.models.hestia.residueBurnt import MODEL, TERM_ID, _should_run, run
6
6
 
7
7
  class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
8
8
  fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
@@ -2,7 +2,7 @@ from unittest.mock import patch
2
2
  import json
3
3
  from tests.utils import fake_new_practice, fixtures_path
4
4
 
5
- from hestia_earth.models.cycle.residueIncorporated import MODEL, TERM_ID, _should_run, run
5
+ from hestia_earth.models.hestia.residueIncorporated import MODEL, TERM_ID, _should_run, run
6
6
 
7
7
  class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
8
8
  fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
@@ -2,7 +2,7 @@ from unittest.mock import patch
2
2
  import json
3
3
  from tests.utils import fake_new_practice, fixtures_path
4
4
 
5
- from hestia_earth.models.cycle.residueLeftOnField import MODEL, TERM_ID, _should_run, run
5
+ from hestia_earth.models.hestia.residueLeftOnField import MODEL, TERM_ID, _should_run, run
6
6
 
7
7
  class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
8
8
  fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
@@ -9,11 +9,23 @@ fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
9
9
 
10
10
 
11
11
  @patch(f"{class_path}._new_practice", side_effect=fake_new_practice)
12
- def test_run(*args):
13
- with open(f"{fixtures_folder}/cycle.jsonld", encoding='utf-8') as f:
12
+ def test_run_by_products(*args):
13
+ with open(f"{fixtures_folder}/by-products/cycle.jsonld", encoding='utf-8') as f:
14
14
  cycle = json.load(f)
15
15
 
16
- with open(f"{fixtures_folder}/result.jsonld", encoding='utf-8') as f:
16
+ with open(f"{fixtures_folder}/by-products/result.jsonld", encoding='utf-8') as f:
17
+ expected = json.load(f)
18
+
19
+ value = run(cycle)
20
+ assert value == expected
21
+
22
+
23
+ @patch(f"{class_path}._new_practice", side_effect=fake_new_practice)
24
+ def test_run_by_practices(*args):
25
+ with open(f"{fixtures_folder}/by-practices/cycle.jsonld", encoding='utf-8') as f:
26
+ cycle = json.load(f)
27
+
28
+ with open(f"{fixtures_folder}/by-practices/result.jsonld", encoding='utf-8') as f:
17
29
  expected = json.load(f)
18
30
 
19
31
  value = run(cycle)
@@ -2,7 +2,7 @@ from unittest.mock import patch
2
2
  import json
3
3
  from tests.utils import fixtures_path, fake_new_measurement
4
4
 
5
- from hestia_earth.models.site.salineWater import MODEL, TERM_ID, _should_run, run
5
+ from hestia_earth.models.hestia.salineWater import MODEL, TERM_ID, _should_run, run
6
6
 
7
7
  class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
8
8
  fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
@@ -4,7 +4,7 @@ import pytest
4
4
 
5
5
  from tests.utils import fixtures_path, fake_new_measurement
6
6
 
7
- from hestia_earth.models.site.soilMeasurement import (
7
+ from hestia_earth.models.hestia.soilMeasurement import (
8
8
  MODEL,
9
9
  MODEL_KEY,
10
10
  _get_overlap,
@@ -13,7 +13,7 @@ from hestia_earth.models.site.soilMeasurement import (
13
13
  )
14
14
 
15
15
  class_path = f"hestia_earth.models.{MODEL}.{MODEL_KEY}"
16
- fixtures_folder = f"{fixtures_path}/site/soilMeasurement"
16
+ fixtures_folder = f"{fixtures_path}/{MODEL}/soilMeasurement"
17
17
 
18
18
 
19
19
  @pytest.mark.parametrize(
@@ -3,7 +3,7 @@ import pytest
3
3
  import json
4
4
  from tests.utils import fixtures_path, fake_new_practice
5
5
 
6
- from hestia_earth.models.cycle.stockingDensityAnimalHousingAverage import MODEL, TERM_ID, run, _should_run
6
+ from hestia_earth.models.hestia.stockingDensityAnimalHousingAverage import MODEL, TERM_ID, run, _should_run
7
7
 
8
8
  class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
9
9
  fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
@@ -2,7 +2,7 @@ from unittest.mock import patch
2
2
  import json
3
3
  from tests.utils import fixtures_path, fake_new_measurement
4
4
 
5
- from hestia_earth.models.site.temperatureAnnual import MODEL, TERM_ID, run, _should_run
5
+ from hestia_earth.models.hestia.temperatureAnnual import MODEL, TERM_ID, run, _should_run
6
6
 
7
7
  class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
8
8
  fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
@@ -2,7 +2,7 @@ from unittest.mock import patch
2
2
  import json
3
3
  from tests.utils import fixtures_path, fake_new_measurement
4
4
 
5
- from hestia_earth.models.site.temperatureMonthly import MODEL, TERM_ID, run, _should_run
5
+ from hestia_earth.models.hestia.temperatureMonthly import MODEL, TERM_ID, run, _should_run
6
6
 
7
7
  class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
8
8
  fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
@@ -2,7 +2,7 @@ from unittest.mock import patch
2
2
  import json
3
3
  from tests.utils import fixtures_path, fake_new_measurement
4
4
 
5
- from hestia_earth.models.site.totalNitrogenPerKgSoil import MODEL, TERM_ID, run, _should_run
5
+ from hestia_earth.models.hestia.totalNitrogenPerKgSoil import MODEL, TERM_ID, run, _should_run
6
6
 
7
7
  class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
8
8
  fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
@@ -2,7 +2,7 @@ from unittest.mock import patch
2
2
  import json
3
3
  from tests.utils import fake_new_practice, fixtures_path
4
4
 
5
- from hestia_earth.models.cycle.unknownPreSeasonWaterRegime import MODEL, TERM_ID, _should_run, run
5
+ from hestia_earth.models.hestia.unknownPreSeasonWaterRegime import MODEL, TERM_ID, _should_run, run
6
6
 
7
7
  class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
8
8
  fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
@@ -2,7 +2,7 @@ from unittest.mock import patch
2
2
  import json
3
3
  from tests.utils import fixtures_path, fake_new_measurement
4
4
 
5
- from hestia_earth.models.site.waterDepth import MODEL, TERM_ID, run
5
+ from hestia_earth.models.hestia.waterDepth import MODEL, TERM_ID, run
6
6
 
7
7
  class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
8
8
  fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
@@ -0,0 +1,26 @@
1
+ from unittest.mock import Mock, patch
2
+ import json
3
+ from tests.utils import fixtures_path, fake_new_measurement
4
+
5
+ from hestia_earth.models.hestia.waterSalinity import MODEL, TERM_ID, 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}._new_measurement", side_effect=fake_new_measurement)
12
+ @patch(f"{class_path}.related_cycles")
13
+ def test_run(mock_related_cycles: Mock, *args):
14
+ with open(f"{fixtures_folder}/site.jsonld", encoding='utf-8') as f:
15
+ site = json.load(f)
16
+
17
+ with open(f"{fixtures_folder}/cycles.jsonld", encoding='utf-8') as f:
18
+ cycles = json.load(f)
19
+
20
+ mock_related_cycles.return_value = cycles
21
+
22
+ with open(f"{fixtures_folder}/result.jsonld", encoding='utf-8') as f:
23
+ expected = json.load(f)
24
+
25
+ value = run(site)
26
+ assert value == expected
@@ -13,11 +13,13 @@ TERMS_BY_ID = {
13
13
  'energyDigestibilityPoultry': {'units': '%'},
14
14
  'neutralDetergentFibreContent': {'units': '%'}
15
15
  }
16
+ IONOPHORE_TERMS = ['ionophores', 'ionophoreAntibiotics']
16
17
 
17
18
 
18
19
  def fake_download_term(term_id: str, *args): return TERMS_BY_ID[term_id]
19
20
 
20
21
 
22
+ @patch(f"{class_path}.get_ionophore_terms", return_value=IONOPHORE_TERMS)
21
23
  @patch(f"hestia_earth.models.{MODEL}.utils.get_milkYield_terms", return_value=[])
22
24
  @patch(f"{class_path}.get_default_digestibility", return_value=70)
23
25
  @patch(f"{class_path}.find_primary_product", return_value={'term': {'@id': 'pig'}})
@@ -52,6 +54,7 @@ def test_should_run(mock_feed, mock_lookup_value, *args):
52
54
  assert should_run is True
53
55
 
54
56
 
57
+ @patch(f"{class_path}.get_ionophore_terms", return_value=IONOPHORE_TERMS)
55
58
  @patch(f"hestia_earth.models.{MODEL}.utils.get_milkYield_terms", return_value=[])
56
59
  @patch("hestia_earth.models.utils.property.download_term", side_effect=fake_download_term)
57
60
  # patch get_node_property to read value from lookups only
@@ -68,6 +71,7 @@ def test_run(*args):
68
71
  assert result == expected
69
72
 
70
73
 
74
+ @patch(f"{class_path}.get_ionophore_terms", return_value=IONOPHORE_TERMS)
71
75
  @patch(f"hestia_earth.models.{MODEL}.utils.get_milkYield_terms", return_value=[])
72
76
  @patch("hestia_earth.models.utils.property.download_term", side_effect=fake_download_term)
73
77
  # patch get_node_property to read value from lookups only
@@ -84,6 +88,7 @@ def test_run_dairy(*args):
84
88
  assert result == expected
85
89
 
86
90
 
91
+ @patch(f"{class_path}.get_ionophore_terms", return_value=IONOPHORE_TERMS)
87
92
  @patch(f"hestia_earth.models.{MODEL}.utils.get_milkYield_terms", return_value=['milkYieldPerBuffaloRaw'])
88
93
  @patch("hestia_earth.models.utils.property.download_term", side_effect=fake_download_term)
89
94
  # patch get_node_property to read value from lookups only
@@ -100,6 +105,7 @@ def test_run_with_milkYield(*args):
100
105
  assert result == expected
101
106
 
102
107
 
108
+ @patch(f"{class_path}.get_ionophore_terms", return_value=IONOPHORE_TERMS)
103
109
  @patch(f"hestia_earth.models.{MODEL}.utils.get_milkYield_terms", return_value=[])
104
110
  @patch("hestia_earth.models.utils.property.download_term", side_effect=fake_download_term)
105
111
  # patch get_node_property to read value from lookups only
@@ -116,6 +122,7 @@ def test_run_non_dairy(*args):
116
122
  assert result == expected
117
123
 
118
124
 
125
+ @patch(f"{class_path}.get_ionophore_terms", return_value=IONOPHORE_TERMS)
119
126
  @patch(f"hestia_earth.models.{MODEL}.utils.get_milkYield_terms", return_value=[])
120
127
  @patch("hestia_earth.models.utils.property.download_term", side_effect=fake_download_term)
121
128
  # patch get_node_property to read value from lookups only
@@ -132,6 +139,7 @@ def test_run_with_ionophores(*args):
132
139
  assert result == expected
133
140
 
134
141
 
142
+ @patch(f"{class_path}.get_ionophore_terms", return_value=IONOPHORE_TERMS)
135
143
  @patch(f"hestia_earth.models.{MODEL}.utils.get_milkYield_terms", return_value=[])
136
144
  @patch("hestia_earth.models.utils.property.download_term", side_effect=fake_download_term)
137
145
  # patch get_node_property to read value from lookups only
@@ -148,6 +156,7 @@ def test_run_without_ionophores(*args):
148
156
  assert result == expected
149
157
 
150
158
 
159
+ @patch(f"{class_path}.get_ionophore_terms", return_value=IONOPHORE_TERMS)
151
160
  @patch(f"hestia_earth.models.{MODEL}.utils.get_milkYield_terms", return_value=[])
152
161
  @patch("hestia_earth.models.utils.property.download_term", side_effect=fake_download_term)
153
162
  # patch get_node_property to read value from lookups only
@@ -161,6 +170,7 @@ def test_run_no_feed(*args):
161
170
  assert result == []
162
171
 
163
172
 
173
+ @patch(f"{class_path}.get_ionophore_terms", return_value=IONOPHORE_TERMS)
164
174
  @patch(f"hestia_earth.models.{MODEL}.utils.get_milkYield_terms", return_value=[])
165
175
  @patch("hestia_earth.models.utils.property.download_term", side_effect=fake_download_term)
166
176
  # patch get_node_property to read value from lookups only
@@ -177,6 +187,7 @@ def test_run_with_system(*args):
177
187
  assert result == expected
178
188
 
179
189
 
190
+ @patch(f"{class_path}.get_ionophore_terms", return_value=IONOPHORE_TERMS)
180
191
  @patch(f"hestia_earth.models.{MODEL}.utils.get_milkYield_terms", return_value=[])
181
192
  @patch("hestia_earth.models.utils.property.download_term", return_value={})
182
193
  @patch(f"{class_path}._new_emission", side_effect=fake_new_emission)
@@ -1,57 +1,25 @@
1
- from unittest.mock import patch
1
+ import os
2
+ import pytest
3
+ from unittest.mock import Mock, patch
2
4
  import json
3
5
  from tests.utils import fixtures_path, fake_new_emission, FLOODED_RICE_TERMS
4
6
 
5
- from hestia_earth.models.ipcc2019.ch4ToAirFloodedRice import MODEL, TERM_ID, run, _should_run
7
+ from hestia_earth.models.ipcc2019.ch4ToAirFloodedRice import MODEL, TERM_ID, run
6
8
 
7
9
  class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
8
10
  fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
11
+ _folders = [d for d in os.listdir(fixtures_folder) if os.path.isdir(os.path.join(fixtures_folder, d))]
9
12
 
10
13
 
11
- @patch(f"{class_path}.has_flooded_rice", return_value=False)
12
- def test_should_run(mock_flooded_rice):
13
- # no site => no run
14
- cycle = {'site': {}}
15
- should_run, *args = _should_run(cycle)
16
- assert not should_run
17
-
18
- # with site => no run
19
- cycle['site'] = {'country': {'@id': 'country'}}
20
- should_run, *args = _should_run(cycle)
21
- assert not should_run
22
-
23
- # with croppingDuration => no run
24
- cycle['practices'] = [{'term': {'@id': 'croppingDuration'}}]
25
- should_run, *args = _should_run(cycle)
26
- assert not should_run
27
-
28
- # with flooded rice => run
29
- mock_flooded_rice.return_value = True
30
- should_run, *args = _should_run(cycle)
31
- assert should_run is True
32
-
33
-
34
- @patch('hestia_earth.models.utils.product.get_rice_paddy_terms', return_value=FLOODED_RICE_TERMS)
35
- @patch(f"{class_path}._new_emission", side_effect=fake_new_emission)
36
- def test_run(*args):
37
- with open(f"{fixtures_folder}/cycle.jsonld", encoding="utf-8") as f:
38
- cycle = json.load(f)
39
-
40
- with open(f"{fixtures_folder}/result.jsonld", encoding="utf-8") as f:
41
- expected = json.load(f)
42
-
43
- result = run(cycle)
44
- assert result == expected
45
-
46
-
14
+ @pytest.mark.parametrize("folder", _folders)
47
15
  @patch('hestia_earth.models.utils.product.get_rice_paddy_terms', return_value=FLOODED_RICE_TERMS)
48
16
  @patch(f"{class_path}._new_emission", side_effect=fake_new_emission)
49
- def test_run_with_optional_data(*args):
50
- with open(f"{fixtures_folder}/with-optional-data/cycle.jsonld", encoding="utf-8") as f:
17
+ def test_run(mock_new_emission: Mock, mock_rice_terms: Mock, folder: str):
18
+ with open(f"{fixtures_folder}/{folder}/cycle.jsonld", encoding="utf-8") as f:
51
19
  cycle = json.load(f)
52
20
 
53
- with open(f"{fixtures_folder}/with-optional-data/result.jsonld", encoding="utf-8") as f:
21
+ with open(f"{fixtures_folder}/{folder}/result.jsonld", encoding="utf-8") as f:
54
22
  expected = json.load(f)
55
23
 
56
24
  result = run(cycle)
57
- assert result == expected
25
+ assert result == expected, folder
@@ -66,7 +66,8 @@ RUN_SCENARIOS = [
66
66
  ("with-gapfilled-start-date-end-date", 1), # Closes issue #972
67
67
  ("forest-to-orchard-with-ground-cover", 3), # Closes issue #989
68
68
  ("orchard-data-complete", 3), # Closes issue #1011
69
- ("orchard-data-partially-complete", 3) # Closes issue #1011
69
+ ("orchard-data-partially-complete", 3), # Closes issue #1011
70
+ ("with-linalgerror", 1)
70
71
  ]
71
72
  """List of (subfolder: str, num_cycles: int)."""
72
73
 
@@ -6,10 +6,19 @@ from unittest.mock import MagicMock, patch
6
6
 
7
7
  from tests.utils import fake_new_emission, fixtures_path, order_list
8
8
 
9
- from hestia_earth.models.ipcc2019.nonCo2EmissionsToAirNaturalVegetationBurning import run, _should_run
10
-
11
- class_path = 'hestia_earth.models.ipcc2019.nonCo2EmissionsToAirNaturalVegetationBurning'
12
- fixtures_folder = f"{fixtures_path}/ipcc2019/nonCo2EmissionsToAirNaturalVegetationBurning"
9
+ from hestia_earth.models.ipcc2019.nonCo2EmissionsToAirNaturalVegetationBurning import MODEL, run, _should_run
10
+
11
+ class_path = f"hestia_earth.models.{MODEL}.nonCo2EmissionsToAirNaturalVegetationBurning"
12
+ fixtures_folder = f"{fixtures_path}/{MODEL}/nonCo2EmissionsToAirNaturalVegetationBurning"
13
+ biomass_utils_path = f"hestia_earth.models.{MODEL}.biomass_utils"
14
+
15
+ COVER_CROP_PROPERTY_TERM_IDS = [
16
+ "catchCrop",
17
+ "coverCrop",
18
+ "groundCover",
19
+ "longFallowCrop",
20
+ "shortFallowCrop"
21
+ ]
13
22
 
14
23
 
15
24
  def _load_fixture(path: str, default=None):
@@ -23,8 +32,9 @@ RUN_SCENARIOS = [
23
32
  ("forest-to-cropland", 4),
24
33
  ("historical-land-cover-mix", 3),
25
34
  ("deforestation-reforestation", 1), # gains should not offset losses
26
- ("no-clearance-via-fire", 1), # LUC in the UK, which has a percentage burned factor of 0
27
- ("forest-to-cropland-with-ground-cover", 4) # Cover crops/ground covers should be ignored
35
+ ("no-clearance-via-fire", 1), # LUC in the UK, which has a percentage burned factor of 0, should run
36
+ ("forest-to-cropland-with-ground-cover", 4), # Cover crops/ground covers should be ignored
37
+ ("single-year", 1) # should not run, multiple years of land cover data required
28
38
  ]
29
39
 
30
40
 
@@ -40,11 +50,13 @@ RUN_IDS = [f"{param[0]}, cycle{param[2]}" for param in RUN_PARAMS]
40
50
 
41
51
  @mark.parametrize("subfolder, num_cycles, cycle_index", RUN_PARAMS, ids=RUN_IDS)
42
52
  @patch(f"{class_path}._new_emission", side_effect=fake_new_emission)
53
+ @patch(f"{biomass_utils_path}.get_cover_crop_property_terms", return_value=COVER_CROP_PROPERTY_TERM_IDS)
43
54
  @patch(f"{class_path}.related_cycles")
44
55
  @patch(f"{class_path}._get_site")
45
56
  def test_run(
46
57
  get_site_mock: MagicMock,
47
58
  related_cycles_mock: MagicMock,
59
+ _get_cover_crop_property_terms_mock: MagicMock,
48
60
  _new_emission_mock: MagicMock,
49
61
  subfolder: str,
50
62
  num_cycles: int,
@@ -66,7 +78,8 @@ def test_run(
66
78
  assert order_list(result) == order_list(expected)
67
79
 
68
80
 
69
- def test_should_run_no_data():
81
+ @patch(f"{biomass_utils_path}.get_cover_crop_property_terms", return_value=COVER_CROP_PROPERTY_TERM_IDS)
82
+ def test_should_run_no_data(*args):
70
83
  CYCLE = {}
71
84
  EXPECTED = False
72
85
 
@@ -74,8 +87,9 @@ def test_should_run_no_data():
74
87
  assert result == EXPECTED
75
88
 
76
89
 
90
+ @patch(f"{biomass_utils_path}.get_cover_crop_property_terms", return_value=COVER_CROP_PROPERTY_TERM_IDS)
77
91
  @patch(f"{class_path}._new_emission", side_effect=fake_new_emission)
78
- def test_run_no_data(*_):
92
+ def test_run_no_data(*args):
79
93
  CYCLE = {}
80
94
  EXPECTED = []
81
95
 
@@ -216,7 +216,8 @@ PARAMS_SHOULD_RUN = [
216
216
  ("tier-2/with-manure-liquid-kg-mass", True), # Closes issue 763
217
217
  ("tier-2/with-manure-dry-kg-n", True), # Closes issue 763
218
218
  ("tier-2/with-manure-fresh-kg-n", True), # Closes issue 763
219
- ("tier-2/with-manure-liquid-kg-n", True) # Closes issue 763
219
+ ("tier-2/with-manure-liquid-kg-n", True), # Closes issue 763
220
+ ("tier-2/with-split-years", True) # Closes issue 1177
220
221
  ]
221
222
  IDS_SHOULD_RUN = [p[0] for p in PARAMS_SHOULD_RUN]
222
223
 
@@ -268,12 +269,13 @@ def test_should_run(
268
269
 
269
270
 
270
271
  @patch(f"{tier_2_utils_path}.related_cycles", return_value=[])
272
+ @patch(f"{utils_path}.get_cover_crop_property_terms", return_value=COVER_CROP_PROPERTY_TERM_IDS)
271
273
  @patch(f"{term_path}.search")
272
274
  @patch(f"{property_path}.download_term")
273
275
  def test_should_run_no_data(
274
276
  download_term_mock: MagicMock,
275
277
  search_mock: MagicMock,
276
- _related_cycles_mock: MagicMock
278
+ *args
277
279
  ):
278
280
  SITE = {}
279
281
  EXPECTED = []
@@ -9,6 +9,7 @@ class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
9
9
  fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
10
10
 
11
11
 
12
+ @patch(f"{class_path}.get_landCover_term_id_from_site_type", return_value='cropland')
12
13
  @patch(f"{class_path}.get_landCover_term_id", return_value='cropland')
13
14
  @patch(f"{class_path}.land_occupation_per_kg", return_value=None)
14
15
  def test_should_run(mock_land_occupation, *args):
@@ -23,6 +24,7 @@ def test_should_run(mock_land_occupation, *args):
23
24
  assert should_run is True
24
25
 
25
26
 
27
+ @patch(f"{class_path}.get_landCover_term_id_from_site_type", return_value='cropland')
26
28
  @patch(f"{class_path}._new_indicator", side_effect=fake_new_indicator)
27
29
  def test_run(*args):
28
30
  with open(f"{fixtures_folder}/impact-assessment.jsonld", encoding='utf-8') as f:
@@ -35,6 +37,7 @@ def test_run(*args):
35
37
  assert value == expected
36
38
 
37
39
 
40
+ @patch(f"{class_path}.get_landCover_term_id_from_site_type", return_value='cropland')
38
41
  @patch(f"{class_path}._new_indicator", side_effect=fake_new_indicator)
39
42
  def test_run_with_plantation(*args):
40
43
  with open(f"{fixtures_folder}/with-orchard-crop/impact-assessment.jsonld", encoding='utf-8') as f:
@@ -1,12 +1,13 @@
1
1
  from unittest.mock import Mock, patch
2
+ from hestia_earth.schema import TermTermType
2
3
 
3
4
  from hestia_earth.models.site.pre_checks.country import run
4
5
 
5
6
  class_path = 'hestia_earth.models.site.pre_checks.country'
6
7
 
7
8
 
8
- @patch(f"{class_path}.download_hestia")
9
- def test_run(mock_download_hestia: Mock):
9
+ @patch(f"{class_path}.download_term")
10
+ def test_run(mock_download_term: Mock):
10
11
  site = {'country': {'@type': 'Term', '@id': 'GADM-GBR'}}
11
12
  run(site)
12
- mock_download_hestia.assert_called_once_with('GADM-GBR')
13
+ mock_download_term.assert_called_once_with('GADM-GBR', TermTermType.REGION)
@@ -39,12 +39,12 @@ TERMS_BY_ID = {
39
39
  }
40
40
 
41
41
 
42
- def fake_download_hestia(term, *args):
42
+ def fake_download_term(term, *args):
43
43
  term_id = term.get('@id') if isinstance(term, dict) else term
44
44
  return TERMS_BY_ID.get(term_id, {})
45
45
 
46
46
 
47
- @patch('hestia_earth.models.utils.blank_node.download_term', side_effect=fake_download_hestia)
47
+ @patch('hestia_earth.models.utils.blank_node.download_term', side_effect=fake_download_term)
48
48
  @patch(f"{class_path}._new_emission", side_effect=fake_new_emission)
49
49
  def test_run(*args):
50
50
  with open(f"{fixtures_folder}/cycle.jsonld", encoding='utf-8') as f:
@@ -22,5 +22,5 @@ def test_run(*args):
22
22
  with open(f"{fixtures_folder}/result.jsonld", encoding="utf-8") as f:
23
23
  expected = json.load(f)
24
24
 
25
- value = run('all', cycle)
26
- assert value == expected
25
+ result = run('all', cycle)
26
+ assert result == expected
@@ -6,15 +6,8 @@ from hestia_earth.models.emissionNotRelevant import MODEL, run
6
6
 
7
7
  class_path = f"hestia_earth.models.{MODEL}"
8
8
  fixtures_folder = f"{fixtures_path}/{MODEL}"
9
- EMISSION_IDS = [
10
- 'ch4ToAirCropResidueBurning',
11
- 'ch4ToAirExcreta',
12
- 'ch4ToAirFuelCombustion',
13
- 'n2OToAirAquacultureSystemsDirect'
14
- ]
15
9
 
16
10
 
17
- @patch(f"{class_path}.get_all_emission_terms", return_value=EMISSION_IDS)
18
11
  @patch(f"{class_path}._new_emission", side_effect=fake_new_emission)
19
12
  def test_run_cropland(*args):
20
13
  with open(f"{fixtures_folder}/cropland/cycle.jsonld", encoding='utf-8') as f:
@@ -27,7 +20,6 @@ def test_run_cropland(*args):
27
20
  assert result == expected
28
21
 
29
22
 
30
- @patch(f"{class_path}.get_all_emission_terms", return_value=EMISSION_IDS)
31
23
  @patch(f"{class_path}._new_emission", side_effect=fake_new_emission)
32
24
  def test_run_pond(*args):
33
25
  with open(f"{fixtures_folder}/pond/cycle.jsonld", encoding='utf-8') as f:
@@ -12,7 +12,7 @@ class_path = 'hestia_earth.models.utils.measurement'
12
12
  fixtures_folder = f"{fixtures_path}/utils/measurement"
13
13
 
14
14
 
15
- @patch(f"{class_path}.include_methodModel", side_effect=lambda n, **kwargs: n)
15
+ @patch(f"{class_path}.include_method", side_effect=lambda n, **kwargs: n)
16
16
  @patch(f"{class_path}.download_term", return_value=TERM)
17
17
  def test_new_measurement(*args):
18
18
  # with a Term as string
@@ -13,11 +13,21 @@ search_results = [{
13
13
 
14
14
  def test_list_sources():
15
15
  sources = _list_sources()
16
- # test `BIBLIO_TITLE`
17
- assert 'Soil organic carbon sequestration rates in vineyard agroecosystems under different soil management practices: A meta-analysis' in sources # noqa: E501
18
- # test `OTHER_BIBLIO_TITLES`
19
- assert '2006 IPCC Guidelines for National Greenhouse Gas Inventories' in sources
20
- assert 'COMMISSION DECISION of 10 June 2010 on guidelines for the calculation of land carbon stocks for the purpose of Annex V to Directive 2009/28/EC' in sources # noqa: E501
16
+ assert sorted(sources) == [
17
+ '2006 IPCC Guidelines for National Greenhouse Gas Inventories',
18
+ '2019 Refinement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories',
19
+ 'A critical review of the conventional SOC to SOM conversion factor',
20
+ 'An Enhanced Global Elevation Model Generalized From Multiple Higher Resolution Source Datasets',
21
+ 'Biofuels: a new methodology to estimate GHG emissions from global land use change',
22
+ 'COMMISSION DECISION of 10 June 2010 on guidelines for the calculation of land carbon stocks for the purpose of Annex V to Directive 2009/28/EC', # noqa: E501
23
+ 'Contribution of Organic Matter and Clay to Soil Cation-Exchange Capacity as Affected by the pH of the Saturating Solution', # noqa: E501
24
+ 'ERA5: Fifth generation of ECMWF atmospheric reanalyses of the global climate',
25
+ 'Harmonized World Soil Database Version 1.2. Food and Agriculture Organization of the United Nations (FAO).', # noqa: E501
26
+ 'Harmonized World Soil Database Version 2.0.',
27
+ 'Modelling spatially explicit impacts from phosphorus emissions in agriculture',
28
+ 'Reducing food’s environmental impacts through producers and consumers',
29
+ 'Soil organic carbon sequestration rates in vineyard agroecosystems under different soil management practices: A meta-analysis', # noqa: E501
30
+ ]
21
31
 
22
32
 
23
33
  @patch(f"{class_path}.search", return_value=search_results)
@@ -10,6 +10,7 @@ class_path = 'hestia_earth.orchestrator.models'
10
10
  folder_path = os.path.join(fixtures_path, 'orchestrator', 'cycle')
11
11
 
12
12
 
13
+ @patch('hestia_earth.models.utils.source.find_sources', return_value=[])
13
14
  @patch('hestia_earth.orchestrator.strategies.merge._merge_version', return_value='0.0.0')
14
15
  def test_run(*args):
15
16
  with open(os.path.join(folder_path, 'config.json'), encoding='utf-8') as f: