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

Files changed (49) hide show
  1. hestia_earth/models/cache_sites.py +1 -1
  2. hestia_earth/models/faostat2018/liveweightPerHead.py +1 -1
  3. hestia_earth/models/faostat2018/product/price.py +1 -1
  4. hestia_earth/models/geospatialDatabase/ecoClimateZone.py +1 -1
  5. hestia_earth/models/geospatialDatabase/region.py +1 -1
  6. hestia_earth/models/geospatialDatabase/utils.py +1 -1
  7. hestia_earth/models/globalCropWaterModel2008/rootingDepth.py +2 -1
  8. hestia_earth/models/haversineFormula/transport/distance.py +1 -1
  9. hestia_earth/models/hestia/aboveGroundCropResidue.py +1 -3
  10. hestia_earth/models/hestia/cropResidueManagement.py +1 -0
  11. hestia_earth/models/hestia/excretaKgMass.py +1 -1
  12. hestia_earth/models/hestia/landCover.py +13 -6
  13. hestia_earth/models/hestia/landOccupationDuringCycle.py +1 -1
  14. hestia_earth/models/hestia/management.py +25 -11
  15. hestia_earth/models/hestia/pastureGrass.py +1 -1
  16. hestia_earth/models/impact_assessment/post_checks/__init__.py +3 -2
  17. hestia_earth/models/impact_assessment/post_checks/remove_no_value.py +13 -0
  18. hestia_earth/models/ipcc2019/biocharOrganicCarbonPerHa.py +2 -1
  19. hestia_earth/models/ipcc2019/ch4ToAirExcreta.py +16 -13
  20. hestia_earth/models/ipcc2019/organicCarbonPerHa.py +5 -1
  21. hestia_earth/models/ipcc2019/organicCarbonPerHa_tier_1.py +88 -101
  22. hestia_earth/models/ipcc2019/organicCarbonPerHa_utils.py +21 -0
  23. hestia_earth/models/mocking/search-results.json +1 -1
  24. hestia_earth/models/site/pre_checks/country.py +1 -2
  25. hestia_earth/models/utils/__init__.py +7 -5
  26. hestia_earth/models/utils/blank_node.py +7 -2
  27. hestia_earth/models/utils/completeness.py +1 -2
  28. hestia_earth/models/utils/emission.py +1 -1
  29. hestia_earth/models/utils/indicator.py +1 -1
  30. hestia_earth/models/utils/input.py +1 -1
  31. hestia_earth/models/utils/management.py +1 -1
  32. hestia_earth/models/utils/measurement.py +2 -1
  33. hestia_earth/models/utils/method.py +1 -2
  34. hestia_earth/models/utils/practice.py +1 -1
  35. hestia_earth/models/utils/product.py +2 -1
  36. hestia_earth/models/utils/property.py +2 -1
  37. hestia_earth/models/utils/term.py +1 -27
  38. hestia_earth/models/version.py +1 -1
  39. {hestia_earth_models-0.74.8.dist-info → hestia_earth_models-0.74.10.dist-info}/METADATA +2 -2
  40. {hestia_earth_models-0.74.8.dist-info → hestia_earth_models-0.74.10.dist-info}/RECORD +49 -46
  41. tests/models/hestia/test_aboveGroundCropResidue.py +13 -35
  42. tests/models/hestia/test_landOccupationDuringCycle.py +9 -2
  43. tests/models/impact_assessment/post_checks/test_remove_cache_fields.py +6 -0
  44. tests/models/impact_assessment/post_checks/test_remove_no_value.py +17 -0
  45. tests/models/ipcc2019/test_ch4ToAirExcreta.py +0 -12
  46. tests/models/ipcc2019/test_organicCarbonPerHa_tier_1.py +1 -1
  47. {hestia_earth_models-0.74.8.dist-info → hestia_earth_models-0.74.10.dist-info}/LICENSE +0 -0
  48. {hestia_earth_models-0.74.8.dist-info → hestia_earth_models-0.74.10.dist-info}/WHEEL +0 -0
  49. {hestia_earth_models-0.74.8.dist-info → hestia_earth_models-0.74.10.dist-info}/top_level.txt +0 -0
@@ -30,7 +30,8 @@ PARAMS_SHOULD_RUN = [
30
30
  ("animal-missing-other-site-data", False), # mis-matched `otherSites` and `otherSitesDuration`
31
31
  ("animal-missing-site-data", False), # closes #1341
32
32
  ("poore-nemecek-2018-orchard", True), # ensure model returns the same value as deprecated one
33
- ("poore-nemecek-2018-cereal", True) # ensure model returns the same value as deprecated one
33
+ ("poore-nemecek-2018-cereal", True), # ensure model returns the same value as deprecated one
34
+ ("animal-no-cycle", False) # closes #1362
34
35
  ]
35
36
  IDS_SHOULD_RUN = [p[0] for p in PARAMS_SHOULD_RUN]
36
37
 
@@ -45,10 +46,16 @@ def test_should_run(
45
46
 
46
47
  impact["cycle"] = cycle
47
48
 
48
- result, *args = _should_run(impact)
49
+ result, *_ = _should_run(impact)
49
50
  assert result == expected
50
51
 
51
52
 
53
+ def test_should_run_no_cycle():
54
+ IMPACT = {}
55
+ result, *_ = _should_run(IMPACT)
56
+ assert result is False
57
+
58
+
52
59
  PARAMS_RUN = [subfolder for subfolder, should_run in PARAMS_SHOULD_RUN if should_run]
53
60
 
54
61
 
@@ -0,0 +1,6 @@
1
+ from hestia_earth.models.impact_assessment.post_checks.remove_cache_fields import run
2
+
3
+
4
+ def test_run():
5
+ impact = {'cache': {}, 'added': ['cache']}
6
+ assert run(impact) == {'added': []}
@@ -0,0 +1,17 @@
1
+ from hestia_earth.models.impact_assessment.post_checks.remove_no_value import run
2
+
3
+
4
+ def test_run():
5
+ impacts = [
6
+ {'value': 10},
7
+ {'value': 0},
8
+ {'value': None},
9
+ {}
10
+ ]
11
+ impact = {'impacts': impacts}
12
+ assert run(impact) == {
13
+ 'impacts': [
14
+ {'value': 10},
15
+ {'value': 0}
16
+ ]
17
+ }
@@ -81,15 +81,3 @@ def test_run_default_high_productivity(*args):
81
81
 
82
82
  value = run(cycle)
83
83
  assert value == expected
84
-
85
-
86
- @patch(f"{class_path}._new_emission", side_effect=fake_new_emission)
87
- def test_excreta_complete(*args):
88
- with open(f"{fixtures_folder}/complete/cycle.jsonld", encoding='utf-8') as f:
89
- cycle = json.load(f)
90
-
91
- with open(f"{fixtures_folder}/complete/result.jsonld", encoding='utf-8') as f:
92
- expected = json.load(f)
93
-
94
- value = run(cycle)
95
- assert value == expected
@@ -136,7 +136,7 @@ def test_assign_ipcc_soil_category(subfolder: str, expected: IpccSoilCategory):
136
136
  with open(f"{folder}/site.jsonld", encoding='utf-8') as f:
137
137
  site = json.load(f)
138
138
 
139
- result = _assign_ipcc_soil_category(site.get("measurements", []))
139
+ result, *_ = _assign_ipcc_soil_category(site.get("measurements", []))
140
140
  assert result == expected
141
141
 
142
142