-
-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: illegal division by zero in percent estimate (#9007)
fix: illegal division by zero in percent estimate #8998
- Loading branch information
1 parent
3476d84
commit 014971b
Showing
4 changed files
with
172 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
tests/unit/expected_test_results/ingredients/en-illegal-division-by-zero.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
{ | ||
"ingredients" : [ | ||
{ | ||
"id" : "en:each-capsule-contains", | ||
"ingredients" : [ | ||
{ | ||
"id" : "en:paracetamol-500-m-5-060198-790", | ||
"percent_estimate" : 100, | ||
"percent_max" : 100, | ||
"percent_min" : 100, | ||
"quantity" : "0 mg", | ||
"quantity_g" : 0, | ||
"text" : "paracetamol 500 m 5 060198 790" | ||
} | ||
], | ||
"percent_estimate" : 100, | ||
"percent_max" : 100, | ||
"percent_min" : 100, | ||
"text" : "each capsule contains" | ||
} | ||
], | ||
"ingredients_analysis" : { | ||
"en:palm-oil-content-unknown" : [ | ||
"en:each-capsule-contains", | ||
"en:paracetamol-500-m-5-060198-790" | ||
], | ||
"en:vegan-status-unknown" : [ | ||
"en:each-capsule-contains", | ||
"en:paracetamol-500-m-5-060198-790" | ||
], | ||
"en:vegetarian-status-unknown" : [ | ||
"en:each-capsule-contains", | ||
"en:paracetamol-500-m-5-060198-790" | ||
] | ||
}, | ||
"ingredients_analysis_tags" : [ | ||
"en:palm-oil-content-unknown", | ||
"en:vegan-status-unknown", | ||
"en:vegetarian-status-unknown" | ||
], | ||
"ingredients_hierarchy" : [ | ||
"en:each-capsule-contains", | ||
"en:paracetamol-500-m-5-060198-790" | ||
], | ||
"ingredients_n" : 2, | ||
"ingredients_n_tags" : [ | ||
"2", | ||
"1-10" | ||
], | ||
"ingredients_original_tags" : [ | ||
"en:each-capsule-contains", | ||
"en:paracetamol-500-m-5-060198-790" | ||
], | ||
"ingredients_percent_analysis" : 1, | ||
"ingredients_tags" : [ | ||
"en:each-capsule-contains", | ||
"en:paracetamol-500-m-5-060198-790" | ||
], | ||
"ingredients_text" : "each capsule contains: paracetamol 500 m 5 060198 790 0 mg.", | ||
"ingredients_with_specified_percent_n" : 0, | ||
"ingredients_with_specified_percent_sum" : 0, | ||
"ingredients_with_unspecified_percent_n" : 1, | ||
"ingredients_with_unspecified_percent_sum" : 100, | ||
"ingredients_without_ciqual_codes" : [ | ||
"en:paracetamol-500-m-5-060198-790" | ||
], | ||
"ingredients_without_ciqual_codes_n" : 1, | ||
"known_ingredients_n" : 0, | ||
"lc" : "en", | ||
"nutriments" : { | ||
"fruits-vegetables-legumes-estimate-from-ingredients_100g" : 0, | ||
"fruits-vegetables-legumes-estimate-from-ingredients_serving" : 0, | ||
"fruits-vegetables-nuts-estimate-from-ingredients_100g" : 0, | ||
"fruits-vegetables-nuts-estimate-from-ingredients_serving" : 0 | ||
}, | ||
"unknown_ingredients_n" : 2 | ||
} |
77 changes: 77 additions & 0 deletions
77
tests/unit/expected_test_results/ingredients/fr-illegal-division-by-zero.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
{ | ||
"ingredients" : [ | ||
{ | ||
"id" : "fr:analyse-moyenne-pour-1", | ||
"ingredients" : [ | ||
{ | ||
"id" : "fr:1472-kj", | ||
"percent_estimate" : 100, | ||
"percent_max" : 100, | ||
"percent_min" : 100, | ||
"text" : "1472 kJ" | ||
} | ||
], | ||
"percent_estimate" : 100, | ||
"percent_max" : 100, | ||
"percent_min" : 100, | ||
"quantity" : "00 g", | ||
"quantity_g" : 0, | ||
"text" : "Analyse moyenne pour 1" | ||
} | ||
], | ||
"ingredients_analysis" : { | ||
"en:palm-oil-content-unknown" : [ | ||
"fr:analyse-moyenne-pour-1", | ||
"fr:1472-kj" | ||
], | ||
"en:vegan-status-unknown" : [ | ||
"fr:analyse-moyenne-pour-1", | ||
"fr:1472-kj" | ||
], | ||
"en:vegetarian-status-unknown" : [ | ||
"fr:analyse-moyenne-pour-1", | ||
"fr:1472-kj" | ||
] | ||
}, | ||
"ingredients_analysis_tags" : [ | ||
"en:palm-oil-content-unknown", | ||
"en:vegan-status-unknown", | ||
"en:vegetarian-status-unknown" | ||
], | ||
"ingredients_hierarchy" : [ | ||
"fr:analyse-moyenne-pour-1", | ||
"fr:1472-kj" | ||
], | ||
"ingredients_n" : 2, | ||
"ingredients_n_tags" : [ | ||
"2", | ||
"1-10" | ||
], | ||
"ingredients_original_tags" : [ | ||
"fr:analyse-moyenne-pour-1", | ||
"fr:1472-kj" | ||
], | ||
"ingredients_percent_analysis" : 1, | ||
"ingredients_tags" : [ | ||
"fr:analyse-moyenne-pour-1", | ||
"fr:1472-kj" | ||
], | ||
"ingredients_text" : "Analyse moyenne pour 1 00 g: 1472 kJ,", | ||
"ingredients_with_specified_percent_n" : 0, | ||
"ingredients_with_specified_percent_sum" : 0, | ||
"ingredients_with_unspecified_percent_n" : 1, | ||
"ingredients_with_unspecified_percent_sum" : 100, | ||
"ingredients_without_ciqual_codes" : [ | ||
"fr:1472-kj" | ||
], | ||
"ingredients_without_ciqual_codes_n" : 1, | ||
"known_ingredients_n" : 0, | ||
"lc" : "fr", | ||
"nutriments" : { | ||
"fruits-vegetables-legumes-estimate-from-ingredients_100g" : 0, | ||
"fruits-vegetables-legumes-estimate-from-ingredients_serving" : 0, | ||
"fruits-vegetables-nuts-estimate-from-ingredients_100g" : 0, | ||
"fruits-vegetables-nuts-estimate-from-ingredients_serving" : 0 | ||
}, | ||
"unknown_ingredients_n" : 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters