fix(tests): move store_with_recipes fixture to conftest.py for cross-module visibility
This commit is contained in:
parent
cfe56c3058
commit
8f4a7bd207
2 changed files with 20 additions and 23 deletions
|
|
@ -24,3 +24,23 @@ def store_with_profiles(tmp_path):
|
||||||
""", ("parmesan", json.dumps(["Depth", "Seasoning"]), 29.0, 29.0, 1.2, 1, 1600.0, 0, "neutral"))
|
""", ("parmesan", json.dumps(["Depth", "Seasoning"]), 29.0, 29.0, 1.2, 1, 1600.0, 0, "neutral"))
|
||||||
store.conn.commit()
|
store.conn.commit()
|
||||||
return store
|
return store
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def store_with_recipes(store_with_profiles):
|
||||||
|
store_with_profiles.conn.executemany("""
|
||||||
|
INSERT INTO recipes (external_id, title, ingredients, ingredient_names,
|
||||||
|
directions, category, keywords, element_coverage)
|
||||||
|
VALUES (?,?,?,?,?,?,?,?)
|
||||||
|
""", [
|
||||||
|
("1", "Butter Pasta", '["butter","pasta","parmesan"]',
|
||||||
|
'["butter","pasta","parmesan"]', '["boil pasta","toss with butter"]',
|
||||||
|
"Italian", '["quick","pasta"]',
|
||||||
|
'{"Richness":0.5,"Depth":0.3,"Structure":0.2}'),
|
||||||
|
("2", "Lentil Soup", '["lentils","carrots","onion","broth"]',
|
||||||
|
'["lentils","carrots","onion","broth"]', '["simmer all"]',
|
||||||
|
"Soup", '["vegan","hearty"]',
|
||||||
|
'{"Depth":0.4,"Seasoning":0.3}'),
|
||||||
|
])
|
||||||
|
store_with_profiles.conn.commit()
|
||||||
|
return store_with_profiles
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,3 @@
|
||||||
import pytest
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def store_with_recipes(store_with_profiles):
|
|
||||||
store_with_profiles.conn.executemany("""
|
|
||||||
INSERT INTO recipes (external_id, title, ingredients, ingredient_names,
|
|
||||||
directions, category, keywords, element_coverage)
|
|
||||||
VALUES (?,?,?,?,?,?,?,?)
|
|
||||||
""", [
|
|
||||||
("1", "Butter Pasta", '["butter","pasta","parmesan"]',
|
|
||||||
'["butter","pasta","parmesan"]', '["boil pasta","toss with butter"]',
|
|
||||||
"Italian", '["quick","pasta"]',
|
|
||||||
'{"Richness":0.5,"Depth":0.3,"Structure":0.2}'),
|
|
||||||
("2", "Lentil Soup", '["lentils","carrots","onion","broth"]',
|
|
||||||
'["lentils","carrots","onion","broth"]', '["simmer all"]',
|
|
||||||
"Soup", '["vegan","hearty"]',
|
|
||||||
'{"Depth":0.4,"Seasoning":0.3}'),
|
|
||||||
])
|
|
||||||
store_with_profiles.conn.commit()
|
|
||||||
return store_with_profiles
|
|
||||||
|
|
||||||
|
|
||||||
def test_search_recipes_by_ingredient_names(store_with_recipes):
|
def test_search_recipes_by_ingredient_names(store_with_recipes):
|
||||||
results = store_with_recipes.search_recipes_by_ingredients(["butter", "parmesan"])
|
results = store_with_recipes.search_recipes_by_ingredients(["butter", "parmesan"])
|
||||||
assert len(results) >= 1
|
assert len(results) >= 1
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue