hestia-earth-models 0.61.8__py3-none-any.whl → 0.62.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.

Potentially problematic release.


This version of hestia-earth-models might be problematic. Click here for more details.

Files changed (64) hide show
  1. hestia_earth/models/blonkConsultants2016/utils.py +3 -2
  2. hestia_earth/models/cycle/completeness/electricityFuel.py +5 -1
  3. hestia_earth/models/cycle/post_checks/__init__.py +3 -2
  4. hestia_earth/models/cycle/post_checks/otherSites.py +40 -0
  5. hestia_earth/models/cycle/pre_checks/__init__.py +2 -1
  6. hestia_earth/models/cycle/pre_checks/otherSites.py +42 -0
  7. hestia_earth/models/cycle/pre_checks/site.py +1 -1
  8. hestia_earth/models/cycle/product/economicValueShare.py +47 -31
  9. hestia_earth/models/ecoinventV3AndEmberClimate/utils.py +1 -1
  10. hestia_earth/models/emepEea2019/utils.py +4 -3
  11. hestia_earth/models/geospatialDatabase/heavyWinterPrecipitation.py +1 -1
  12. hestia_earth/models/ipcc2019/animal/pastureGrass.py +36 -30
  13. hestia_earth/models/ipcc2019/co2ToAirSoilOrganicCarbonStockChangeManagementChange.py +30 -4
  14. hestia_earth/models/ipcc2019/n2OToAirExcretaDirect.py +6 -2
  15. hestia_earth/models/ipcc2019/n2OToAirExcretaIndirect.py +1 -1
  16. hestia_earth/models/ipcc2019/n2OToAirInorganicFertiliserDirect.py +1 -1
  17. hestia_earth/models/ipcc2019/n2OToAirInorganicFertiliserIndirect.py +1 -1
  18. hestia_earth/models/ipcc2019/n2OToAirOrganicFertiliserIndirect.py +1 -1
  19. hestia_earth/models/ipcc2019/organicCarbonPerHa.py +4 -6
  20. hestia_earth/models/ipcc2019/organicCarbonPerHa_tier_1_utils.py +4 -2
  21. hestia_earth/models/ipcc2019/organicCarbonPerHa_tier_2_utils.py +12 -11
  22. hestia_earth/models/ipcc2019/pastureGrass.py +40 -22
  23. hestia_earth/models/ipcc2019/pastureGrass_utils.py +43 -60
  24. hestia_earth/models/mocking/search-results.json +261 -257
  25. hestia_earth/models/schererPfister2015/utils.py +2 -2
  26. hestia_earth/models/site/brackishWater.py +1 -1
  27. hestia_earth/models/site/flowingWater.py +1 -1
  28. hestia_earth/models/site/freshWater.py +1 -1
  29. hestia_earth/models/site/management.py +29 -11
  30. hestia_earth/models/site/pre_checks/cache_sources.py +9 -13
  31. hestia_earth/models/site/salineWater.py +1 -1
  32. hestia_earth/models/stehfestBouwman2006/n2OToAirCropResidueDecompositionDirect.py +12 -2
  33. hestia_earth/models/stehfestBouwman2006/n2OToAirExcretaDirect.py +12 -2
  34. hestia_earth/models/stehfestBouwman2006/n2OToAirInorganicFertiliserDirect.py +11 -1
  35. hestia_earth/models/stehfestBouwman2006/n2OToAirOrganicFertiliserDirect.py +11 -1
  36. hestia_earth/models/stehfestBouwman2006/noxToAirCropResidueDecomposition.py +12 -2
  37. hestia_earth/models/stehfestBouwman2006/noxToAirExcreta.py +12 -2
  38. hestia_earth/models/stehfestBouwman2006/noxToAirInorganicFertiliser.py +11 -1
  39. hestia_earth/models/stehfestBouwman2006/noxToAirOrganicFertiliser.py +11 -1
  40. hestia_earth/models/stehfestBouwman2006GisImplementation/noxToAirCropResidueDecomposition.py +12 -2
  41. hestia_earth/models/stehfestBouwman2006GisImplementation/noxToAirExcreta.py +12 -2
  42. hestia_earth/models/stehfestBouwman2006GisImplementation/noxToAirInorganicFertiliser.py +11 -1
  43. hestia_earth/models/stehfestBouwman2006GisImplementation/noxToAirOrganicFertiliser.py +11 -1
  44. hestia_earth/models/utils/blank_node.py +159 -146
  45. hestia_earth/models/utils/constant.py +2 -0
  46. hestia_earth/models/utils/lookup.py +19 -6
  47. hestia_earth/models/utils/source.py +1 -1
  48. hestia_earth/models/version.py +1 -1
  49. {hestia_earth_models-0.61.8.dist-info → hestia_earth_models-0.62.1.dist-info}/METADATA +3 -3
  50. {hestia_earth_models-0.61.8.dist-info → hestia_earth_models-0.62.1.dist-info}/RECORD +64 -59
  51. tests/models/cycle/post_checks/test_otherSites.py +15 -0
  52. tests/models/cycle/pre_checks/test_otherSites.py +21 -0
  53. tests/models/cycle/product/test_economicValueShare.py +8 -0
  54. tests/models/ipcc2019/animal/test_pastureGrass.py +2 -2
  55. tests/models/ipcc2019/test_co2ToAirSoilOrganicCarbonStockChangeManagementChange.py +5 -2
  56. tests/models/ipcc2019/test_organicCarbonPerHa.py +2 -1
  57. tests/models/ipcc2019/test_pastureGrass.py +0 -16
  58. tests/models/site/pre_checks/test_cache_sources.py +6 -10
  59. tests/models/site/test_management.py +162 -2
  60. tests/models/utils/test_blank_node.py +154 -296
  61. tests/models/utils/test_lookup.py +10 -0
  62. {hestia_earth_models-0.61.8.dist-info → hestia_earth_models-0.62.1.dist-info}/LICENSE +0 -0
  63. {hestia_earth_models-0.61.8.dist-info → hestia_earth_models-0.62.1.dist-info}/WHEEL +0 -0
  64. {hestia_earth_models-0.61.8.dist-info → hestia_earth_models-0.62.1.dist-info}/top_level.txt +0 -0
@@ -12,16 +12,14 @@ from hestia_earth.models.utils.blank_node import (
12
12
  _get_datestr_format,
13
13
  _run_required,
14
14
  _run_model_required,
15
- _should_run_array_treatment,
16
- ArrayTreatment,
17
15
  cumulative_nodes_match,
18
16
  DatestrFormat,
19
17
  DatestrGapfillMode,
20
18
  DatetimeRange,
21
- get_node_value,
22
19
  group_nodes_by_year,
23
20
  group_nodes_by_year_and_month,
24
- GroupNodesByYearMode
21
+ GroupNodesByYearMode,
22
+ split_node_by_dates
25
23
  )
26
24
 
27
25
 
@@ -62,282 +60,6 @@ def test_run_model_required():
62
60
  })
63
61
 
64
62
 
65
- # --- test should_run_array_treatment ---
66
-
67
-
68
- def test_should_run_array_treatment_true():
69
- VALUE = [24, 87, 34, 12]
70
- assert _should_run_array_treatment(VALUE) is True
71
-
72
-
73
- def test_should_run_array_treatment_false_empty_list():
74
- VALUE = []
75
- assert _should_run_array_treatment(VALUE) is False
76
-
77
-
78
- def test_should_run_array_treatment_false_not_iterable():
79
- VALUE = 1
80
- assert _should_run_array_treatment(VALUE) is False
81
-
82
-
83
- # --- test get_node_value ---
84
-
85
-
86
- FULL_TILLAGE_AS_PRACTICE = {
87
- "@type": "Practice",
88
- "term": {
89
- "@type": "Term",
90
- "@id": "fullTillage"
91
- },
92
- "value": [50, 50, 60, 70]
93
- }
94
-
95
- FULL_TILLAGE_AS_MANAGEMENT = {
96
- "@type": "Management",
97
- "term": {
98
- "@type": "Term",
99
- "@id": "fullTillage"
100
- },
101
- "value": 100
102
- }
103
-
104
- EXPECTED_EMPTY_LIST = 0
105
-
106
-
107
- @patch(f"{class_path}._retrieve_array_treatment", return_value=ArrayTreatment.FIRST)
108
- def test_get_node_value_list_reduce_default(*args):
109
- """
110
- Should return the reduced value of the value list using the array treatment specified in the term lookup
111
- (or ArrayTreatment.FIRST if no lookup value available).
112
-
113
- The lookup array treatment for `fullTillage` is `first`, therefore a return value of `50` is expected.
114
- """
115
- EXPECTED = 50
116
- result = get_node_value(FULL_TILLAGE_AS_PRACTICE)
117
- assert result == EXPECTED
118
-
119
-
120
- @patch(f"{class_path}._retrieve_array_treatment", return_value=ArrayTreatment.FIRST)
121
- def test_get_node_value_list_reduce_mean(*args):
122
- """
123
- Should return the mean value of the value list.
124
-
125
- `statistics.mean` function is used here.
126
- """
127
- EXPECTED = 57.5
128
- result = get_node_value(
129
- FULL_TILLAGE_AS_PRACTICE, array_treatment=ArrayTreatment.MEAN
130
- )
131
- assert result == EXPECTED
132
-
133
-
134
- @patch(f"{class_path}._retrieve_array_treatment", return_value=ArrayTreatment.FIRST)
135
- def test_get_node_value_list_reduce_mode(*args):
136
- """
137
- Should return the mode value of the value list.
138
-
139
- `statistics.mode` function is used here.
140
- """
141
- EXPECTED = 50
142
- result = get_node_value(
143
- FULL_TILLAGE_AS_PRACTICE, array_treatment=ArrayTreatment.MODE
144
- )
145
- assert result == EXPECTED
146
-
147
-
148
- @patch(f"{class_path}._retrieve_array_treatment", return_value=ArrayTreatment.FIRST)
149
- def test_get_node_value_list_reduce_sum(*args):
150
- """
151
- Should return the sum value of the value list.
152
- """
153
- EXPECTED = 230
154
- result = get_node_value(
155
- FULL_TILLAGE_AS_PRACTICE, array_treatment=ArrayTreatment.SUM
156
- )
157
- assert result == EXPECTED
158
-
159
-
160
- @patch(f"{class_path}._retrieve_array_treatment", return_value=ArrayTreatment.FIRST)
161
- def test_get_node_value_list_reduce_first(*args):
162
- """
163
- Should return the first value of the value list.
164
- """
165
- EXPECTED = 50
166
- result = get_node_value(
167
- FULL_TILLAGE_AS_PRACTICE, array_treatment=ArrayTreatment.FIRST
168
- )
169
- assert result == EXPECTED
170
-
171
-
172
- @patch(f"{class_path}._retrieve_array_treatment", return_value=ArrayTreatment.FIRST)
173
- def test_get_node_value_list_reduce_last(*args):
174
- """
175
- Should return the last value of the value list.
176
- """
177
- EXPECTED = 70
178
- result = get_node_value(
179
- FULL_TILLAGE_AS_PRACTICE, array_treatment=ArrayTreatment.LAST
180
- )
181
- assert result == EXPECTED
182
-
183
-
184
- @patch(f"{class_path}._retrieve_array_treatment", return_value=ArrayTreatment.FIRST)
185
- def test_get_node_value_list_bools_reduce_mean(*args):
186
- """
187
- If value is list of bools, the `satistics.mean` interprets them as integers (0 or 1),
188
- therefore number is returned.
189
- """
190
- EXPECTED = 1/3
191
- NODE = {"value": [False, False, True]}
192
- result = get_node_value(
193
- NODE, array_treatment=ArrayTreatment.MEAN
194
- )
195
- assert result == EXPECTED
196
-
197
-
198
- @patch(f"{class_path}._retrieve_array_treatment", return_value=ArrayTreatment.FIRST)
199
- def test_get_node_value_list_bools_reduce_mode(*args):
200
- """
201
- If value is list of bools, the `satistics.mode` interprets them as bools and returns the most
202
- common bool value as expected.
203
- """
204
- EXPECTED = False
205
- NODE = {"value": [False, False, True]}
206
- result = get_node_value(
207
- NODE, array_treatment=ArrayTreatment.MODE
208
- )
209
- assert result == EXPECTED
210
- assert isinstance(result, bool)
211
-
212
-
213
- @patch(f"{class_path}._retrieve_array_treatment", return_value=ArrayTreatment.FIRST)
214
- def test_get_node_value_list_bools_reduce_sum(*args):
215
- """
216
- If value is list of bools, the built-in `sum` interprets them as integers (0 or 1),
217
- therefore number is returned.
218
- """
219
- EXPECTED = 1
220
- NODE = {"value": [False, False, True]}
221
- result = get_node_value(
222
- NODE, array_treatment=ArrayTreatment.SUM
223
- )
224
- assert result == EXPECTED
225
-
226
-
227
- @patch(f"{class_path}._retrieve_array_treatment", return_value=ArrayTreatment.FIRST)
228
- def test_get_node_value_empty_list_reduce_default(*args):
229
- """
230
- Empty list return as 0 if keyword arg `reduce_value_list` = `True`.
231
- """
232
- NODE = {"value": []}
233
- result = get_node_value(NODE)
234
- assert result == EXPECTED_EMPTY_LIST
235
-
236
-
237
- @patch(f"{class_path}._retrieve_array_treatment", return_value=ArrayTreatment.FIRST)
238
- def test_get_node_value_empty_list_reduce_mean(*args):
239
- """
240
- Empty list return as 0 if keyword arg `reduce_value_list` = `True`.
241
- """
242
- NODE = {"value": []}
243
- result = get_node_value(
244
- NODE, array_treatment=ArrayTreatment.MEAN
245
- )
246
- assert result == EXPECTED_EMPTY_LIST
247
-
248
-
249
- @patch(f"{class_path}._retrieve_array_treatment", return_value=ArrayTreatment.FIRST)
250
- def test_get_node_value_empty_list_reduce_mode(*args):
251
- """
252
- Empty list return as 0 if keyword arg `reduce_value_list` = `True`.
253
- """
254
- NODE = {"value": []}
255
- result = get_node_value(
256
- NODE, array_treatment=ArrayTreatment.MODE
257
- )
258
- assert result == EXPECTED_EMPTY_LIST
259
-
260
-
261
- @patch(f"{class_path}._retrieve_array_treatment", return_value=ArrayTreatment.FIRST)
262
- def test_get_node_value_empty_list_reduce_sum(*args):
263
- """
264
- Empty list return as 0 if keyword arg `reduce_value_list` = `True`.
265
- """
266
- NODE = {"value": []}
267
- result = get_node_value(
268
- NODE, array_treatment=ArrayTreatment.SUM
269
- )
270
- assert result == EXPECTED_EMPTY_LIST
271
-
272
-
273
- @patch(f"{class_path}._retrieve_array_treatment", return_value=ArrayTreatment.FIRST)
274
- def test_get_node_value_empty_list_reduce_first(*args):
275
- """
276
- Empty list return as 0 if keyword arg `reduce_value_list` = `True`.
277
- """
278
- NODE = {"value": []}
279
- result = get_node_value(
280
- NODE, array_treatment=ArrayTreatment.FIRST
281
- )
282
- assert result == EXPECTED_EMPTY_LIST
283
-
284
-
285
- @patch(f"{class_path}._retrieve_array_treatment", return_value=ArrayTreatment.FIRST)
286
- def test_get_node_value_empty_list_reduce_last(*args):
287
- """
288
- Empty list return as 0 if keyword arg `reduce_value_list` = `True`.
289
- """
290
- NODE = {"value": []}
291
- result = get_node_value(
292
- NODE, array_treatment=ArrayTreatment.LAST
293
- )
294
- assert result == EXPECTED_EMPTY_LIST
295
-
296
-
297
- @patch(f"{class_path}._retrieve_array_treatment", return_value=ArrayTreatment.FIRST)
298
- def test_get_node_value_float(*args):
299
- """
300
- Non-list values are returned directly, even if if keyword arg `reduce_value_list` = `True`.
301
- """
302
- EXPECTED = 100
303
- result = get_node_value(FULL_TILLAGE_AS_MANAGEMENT)
304
- assert result == EXPECTED
305
-
306
-
307
- @patch(f"{class_path}._retrieve_array_treatment", return_value=ArrayTreatment.FIRST)
308
- def test_get_node_value_bool_true(*args):
309
- """
310
- Non-list values are returned directly, even if if keyword arg `reduce_value_list` = `True`.
311
- """
312
- EXPECTED = True
313
- NODE = {"value": True}
314
- result = get_node_value(NODE)
315
- assert result == EXPECTED
316
-
317
-
318
- @patch(f"{class_path}._retrieve_array_treatment", return_value=ArrayTreatment.FIRST)
319
- def test_get_node_value_bool_false(*args):
320
- """
321
- Non-list values are returned directly, even if if keyword arg `reduce_value_list` = `True`.
322
- """
323
- EXPECTED = False
324
- NODE = {"value": False}
325
- result = get_node_value(NODE)
326
- assert result == EXPECTED
327
- assert isinstance(result, bool)
328
-
329
-
330
- @patch(f"{class_path}._retrieve_array_treatment", return_value=ArrayTreatment.FIRST)
331
- def test_get_node_value_no_value(*args):
332
- """
333
- Missing values are returned as 0.
334
- """
335
- EXPECTED = 0
336
- NODE = {}
337
- result = get_node_value(NODE)
338
- assert result == EXPECTED
339
-
340
-
341
63
  # --- test cumulative_nodes_match ---
342
64
 
343
65
 
@@ -369,7 +91,6 @@ CROP_RESIDUE_NODES = [
369
91
  ]
370
92
 
371
93
 
372
- @patch(f"{class_path}._retrieve_array_treatment", return_value=ArrayTreatment.MEAN)
373
94
  def test_cumulative_nodes_match_true(*args):
374
95
  result = cumulative_nodes_match(
375
96
  lambda node: node.get("term", {}).get("@id") in [
@@ -381,7 +102,6 @@ def test_cumulative_nodes_match_true(*args):
381
102
  assert result is True
382
103
 
383
104
 
384
- @patch(f"{class_path}._retrieve_array_treatment", return_value=ArrayTreatment.MEAN)
385
105
  def test_cumulative_nodes_match_false(*args):
386
106
  result = cumulative_nodes_match(
387
107
  lambda node: node.get("term", {}).get("@id") in ["aboveGroundCropResidueLeftOnField"],
@@ -1017,33 +737,67 @@ def test_group_nodes_by_year_multiple_values_and_dates(mock_parse, system_dateti
1017
737
  "2001-02",
1018
738
  "2002-03",
1019
739
  "2003-01"
740
+ ],
741
+ "sd": [
742
+ 0.8, 0.9, 1.0, 0.9, 0.8
743
+ ],
744
+ "observations": [
745
+ 100, 100, 100, 100, 100
1020
746
  ]
1021
747
  }]
1022
748
 
1023
749
  EXPECTED = {
1024
- 2000: [{
1025
- "dates": ["2000-01", "2000-06"],
1026
- "fraction_of_node_duration": 0.32475598935226263,
1027
- "fraction_of_group_duration": 1.0,
1028
- "value": [1, 2]
1029
- }],
750
+ 2000: [
751
+ {
752
+ "dates": ["2000-01"],
753
+ "fraction_of_node_duration": 1.0,
754
+ "fraction_of_group_duration": 0.08469945355191257,
755
+ "value": [1],
756
+ "sd": [0.8],
757
+ "observations": [
758
+ 100
759
+ ]
760
+ },
761
+ {
762
+ "dates": ["2000-06"],
763
+ "fraction_of_node_duration": 1.0,
764
+ "fraction_of_group_duration": 0.08196721311475409,
765
+ "value": [2],
766
+ "sd": [0.9],
767
+ "observations": [
768
+ 100
769
+ ]
770
+ }
771
+ ],
1030
772
  2001: [{
1031
773
  "dates": ["2001-02"],
1032
- "fraction_of_node_duration": 0.323868677905945,
1033
- "fraction_of_group_duration": 1.0,
1034
- "value": [3]
774
+ "fraction_of_node_duration": 1.0,
775
+ "fraction_of_group_duration": 0.07671232876712329,
776
+ "value": [3],
777
+ "sd": [1.0],
778
+ "observations": [
779
+ 100
780
+ ]
1035
781
  }],
1036
782
  2002: [{
1037
783
  "dates": ["2002-03"],
1038
- "fraction_of_node_duration": 0.323868677905945,
1039
- "fraction_of_group_duration": 1.0,
1040
- "value": [4]
784
+ "fraction_of_node_duration": 1.0,
785
+ "fraction_of_group_duration": 0.08493150684931507,
786
+ "value": [4],
787
+ "sd": [0.9],
788
+ "observations": [
789
+ 100
790
+ ]
1041
791
  }],
1042
792
  2003: [{
1043
793
  "dates": ["2003-01"],
1044
- "fraction_of_node_duration": 0.027506654835847383,
794
+ "fraction_of_node_duration": 1.0,
1045
795
  "fraction_of_group_duration": 0.08493150684931507,
1046
- "value": [5]
796
+ "value": [5],
797
+ "sd": [0.8],
798
+ "observations": [
799
+ 100
800
+ ]
1047
801
  }]
1048
802
  }
1049
803
 
@@ -1134,3 +888,107 @@ def test_group_nodes_by_year_and_month(mock_parse, system_datetime):
1134
888
 
1135
889
  result = group_nodes_by_year_and_month(MANAGEMENT)
1136
890
  assert result == EXPECTED
891
+
892
+
893
+ # node, expected
894
+ PARAMS_SPLIT_NODE = [
895
+ (
896
+ {},
897
+ [{}]
898
+ ),
899
+ (
900
+ {"value": [1, 2, 3], "dates": ["2000"]},
901
+ [{"value": [1, 2, 3], "dates": ["2000"]}]
902
+ ),
903
+ (
904
+ {"value": [1, 2, 3], "startDate": "2000", "endDate": "2001"},
905
+ [{"value": [1, 2, 3], "startDate": "2000", "endDate": "2001"}]
906
+ ),
907
+ (
908
+ {"value": 1, "startDate": "2000", "endDate": "2001"},
909
+ [{"value": 1, "startDate": "2000", "endDate": "2001"}]
910
+ ),
911
+ (
912
+ {"value": None},
913
+ [{"value": None}]
914
+ ),
915
+ (
916
+ {"value": [1, 2, 3], "dates": ["2000", "2001", "2002"]},
917
+ [
918
+ {"value": [1], "dates": ["2000"]},
919
+ {"value": [2], "dates": ["2001"]},
920
+ {"value": [3], "dates": ["2002"]}
921
+ ]
922
+ ),
923
+ (
924
+ {
925
+ "value": [1, 2],
926
+ "dates": ["2000", "2001"],
927
+ "sd": [0.816496, 0.816496],
928
+ "min": [0, 1],
929
+ "max": [2, 3],
930
+ "observations": [3, 3]
931
+ },
932
+ [
933
+ {
934
+ "value": [1],
935
+ "dates": ["2000"],
936
+ "sd": [0.816496],
937
+ "min": [0],
938
+ "max": [2],
939
+ "observations": [3]
940
+ },
941
+ {
942
+ "value": [2],
943
+ "dates": ["2001"],
944
+ "sd": [0.816496],
945
+ "min": [1],
946
+ "max": [3],
947
+ "observations": [3]
948
+ }
949
+ ]
950
+ ),
951
+ (
952
+ {
953
+ "value": [1, 2],
954
+ "dates": ["2000", "2001"],
955
+ "sd": [0.816496, 0.816496],
956
+ "min": [0, 1],
957
+ "max": [2, 3],
958
+ "observations": [3]
959
+ },
960
+ [
961
+ {
962
+ "value": [1],
963
+ "dates": ["2000"],
964
+ "sd": [0.816496],
965
+ "min": [0],
966
+ "max": [2],
967
+ "observations": [3]
968
+ },
969
+ {
970
+ "value": [2],
971
+ "dates": ["2001"],
972
+ "sd": [0.816496],
973
+ "min": [1],
974
+ "max": [3],
975
+ "observations": [3]
976
+ }
977
+ ]
978
+ )
979
+ ]
980
+ IDS_SPLIT_NODE = [
981
+ "no split -> empty node",
982
+ "no split -> not enough dates", # len(value) and len(dates) MUST match
983
+ "no split -> startDate & endDate",
984
+ "no split -> non-iterable value", # i.e., on a Management or Animal node.
985
+ "no split -> null value", # i.e., on a Animal node where value is not required.
986
+ "value & dates",
987
+ "descriptive statistics",
988
+ "descriptive statistics w/ bad key" # if descriptive statistic keys have wrong length, don't split them
989
+ ]
990
+
991
+
992
+ @mark.parametrize("node, expected", PARAMS_SPLIT_NODE, ids=IDS_SPLIT_NODE)
993
+ def test_split_node_by_dates(node, expected):
994
+ assert split_node_by_dates(node) == expected
@@ -0,0 +1,10 @@
1
+ from hestia_earth.models.utils.lookup import is_siteType_allowed
2
+
3
+
4
+ def test_is_siteType_allowed():
5
+ term = {'@id': 'pastureGrass', 'termType': 'landUseManagement'}
6
+ site = {'@type': 'Site', 'siteType': 'cropland'}
7
+ assert not is_siteType_allowed(site, term)
8
+
9
+ cycle = {'otherSites': [{'@type': 'Site', 'siteType': 'permanent pasture'}]}
10
+ assert is_siteType_allowed(cycle, term) is True