mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-05 13:35:23 +02:00
feat: Structured Yields (#4489)
Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
This commit is contained in:
parent
c8cd68b4f0
commit
327da02fc8
39 changed files with 1018 additions and 551 deletions
|
@ -275,22 +275,102 @@ yield_test_cases = (
|
|||
CleanerCase(
|
||||
test_id="empty string",
|
||||
input="",
|
||||
expected="",
|
||||
expected=(0, 0, ""),
|
||||
),
|
||||
CleanerCase(
|
||||
test_id="regular string",
|
||||
input="4 Batches",
|
||||
expected=(0, 4, "Batches"),
|
||||
),
|
||||
CleanerCase(
|
||||
test_id="regular serving string",
|
||||
input="4 Servings",
|
||||
expected=(4, 0, ""),
|
||||
),
|
||||
CleanerCase(
|
||||
test_id="regular string with whitespace",
|
||||
input="4 Batches ",
|
||||
expected=(0, 4, "Batches"),
|
||||
),
|
||||
CleanerCase(
|
||||
test_id="regular serving string with whitespace",
|
||||
input="4 Servings ",
|
||||
expected=(4, 0, ""),
|
||||
),
|
||||
CleanerCase(
|
||||
test_id="list of strings",
|
||||
input=["Makes 4 Batches", "4 Batches"],
|
||||
expected="4 Batches",
|
||||
input=["Serves 2", "4 Batches", "5 Batches"],
|
||||
expected=(2, 5, "Batches"),
|
||||
),
|
||||
CleanerCase(
|
||||
test_id="basic string",
|
||||
input="Makes a lot of Batches",
|
||||
expected=(0, 0, "Makes a lot of Batches"),
|
||||
),
|
||||
CleanerCase(
|
||||
test_id="basic serving string",
|
||||
input="Makes 4 Batches",
|
||||
expected="Makes 4 Batches",
|
||||
expected=(4, 0, ""),
|
||||
),
|
||||
CleanerCase(
|
||||
test_id="empty list",
|
||||
input=[],
|
||||
expected="",
|
||||
expected=(0, 0, ""),
|
||||
),
|
||||
CleanerCase(
|
||||
test_id="basic fraction",
|
||||
input="1/2 Batches",
|
||||
expected=(0, 0.5, "Batches"),
|
||||
),
|
||||
CleanerCase(
|
||||
test_id="mixed fraction",
|
||||
input="1 1/2 Batches",
|
||||
expected=(0, 1.5, "Batches"),
|
||||
),
|
||||
CleanerCase(
|
||||
test_id="improper fraction",
|
||||
input="11/2 Batches",
|
||||
expected=(0, 5.5, "Batches"),
|
||||
),
|
||||
CleanerCase(
|
||||
test_id="vulgar fraction",
|
||||
input="¾ Batches",
|
||||
expected=(0, 0.75, "Batches"),
|
||||
),
|
||||
CleanerCase(
|
||||
test_id="mixed vulgar fraction",
|
||||
input="2¾ Batches",
|
||||
expected=(0, 2.75, "Batches"),
|
||||
),
|
||||
CleanerCase(
|
||||
test_id="mixed vulgar fraction with space",
|
||||
input="2 ¾ Batches",
|
||||
expected=(0, 2.75, "Batches"),
|
||||
),
|
||||
CleanerCase(
|
||||
test_id="basic decimal",
|
||||
input="0.5 Batches",
|
||||
expected=(0, 0.5, "Batches"),
|
||||
),
|
||||
CleanerCase(
|
||||
test_id="text with numbers",
|
||||
input="6 Batches or 10 Batches",
|
||||
expected=(0, 6, "Batches or 10 Batches"),
|
||||
),
|
||||
CleanerCase(
|
||||
test_id="no qty",
|
||||
input="A Lot of Servings",
|
||||
expected=(0, 0, "A Lot of Servings"),
|
||||
),
|
||||
CleanerCase(
|
||||
test_id="invalid qty",
|
||||
input="1/0 Batches",
|
||||
expected=(0, 0, "1/0 Batches"),
|
||||
),
|
||||
CleanerCase(
|
||||
test_id="int as float",
|
||||
input="3.0 Batches",
|
||||
expected=(0, 3, "Batches"),
|
||||
),
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue