mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-05 13:35:23 +02:00
refactor: remove depreciated repo call (#1370)
* ingredient parser hot fixes (float equality) * remove `get` in favor of `get_one` & `multi_query`
This commit is contained in:
parent
b904b161eb
commit
932f4a72df
10 changed files with 25 additions and 44 deletions
2
tests/fixtures/fixture_shopping_lists.py
vendored
2
tests/fixtures/fixture_shopping_lists.py
vendored
|
@ -75,7 +75,7 @@ def list_with_items(database: AllRepositories, unique_user: TestUser):
|
|||
)
|
||||
|
||||
# refresh model
|
||||
list_model = database.group_shopping_lists.get(list_model.id)
|
||||
list_model = database.group_shopping_lists.get_one(list_model.id)
|
||||
|
||||
yield list_model
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class Routes:
|
|||
|
||||
|
||||
def assert_ingredient(api_response: dict, test_ingredient: TestIngredient):
|
||||
assert api_response["ingredient"]["quantity"] == test_ingredient.quantity
|
||||
assert api_response["ingredient"]["quantity"] == pytest.approx(test_ingredient.quantity)
|
||||
assert api_response["ingredient"]["unit"]["name"] == test_ingredient.unit
|
||||
assert api_response["ingredient"]["food"]["name"] == test_ingredient.food
|
||||
assert api_response["ingredient"]["note"] == test_ingredient.comments
|
||||
|
|
|
@ -31,7 +31,7 @@ test_ingredients = [
|
|||
# Small Fraction Tests - PR #1369
|
||||
# Reported error is was for 1/8 - new lowest expected threshold is 1/32
|
||||
TestIngredient("1/8 cup all-purpose flour", 0.125, "cup", "all-purpose flour", ""),
|
||||
TestIngredient("1/32 cup all-purpose flour", 0.03125, "cup", "all-purpose flour", ""),
|
||||
TestIngredient("1/32 cup all-purpose flour", 0.031, "cup", "all-purpose flour", ""),
|
||||
]
|
||||
|
||||
|
||||
|
@ -41,7 +41,7 @@ def test_nlp_parser():
|
|||
|
||||
# Itterate over mdoels and test_ingreidnets to gether
|
||||
for model, test_ingredient in zip(models, test_ingredients):
|
||||
assert float(sum(Fraction(s) for s in model.qty.split())) == test_ingredient.quantity
|
||||
assert round(float(sum(Fraction(s) for s in model.qty.split())), 3) == pytest.approx(test_ingredient.quantity)
|
||||
|
||||
assert model.comment == test_ingredient.comments
|
||||
assert model.name == test_ingredient.food
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue