Skip to content

Commit c67cf89

Browse files
committed
Added test case for retrieval with no genres
1 parent f7d13c6 commit c67cf89

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

‎tests/test_retrieval_utils.py‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,24 @@ def test_get_recommendations_single_genre(tmp_path: Path,
140140

141141
# Assert on the results
142142
assert [item["name"] for item in result] == ["Alpha", "Gamma"]
143-
assert all("description" in item for item in result)
143+
assert all("description" in item for item in result)
144+
145+
146+
def test_get_recommendations_no_genre(tmp_path: Path,
147+
monkeypatch: pytest.MonkeyPatch):
148+
# Setup Test Data and Mocks
149+
# Construct a temporary path for the Test DB
150+
db_path = tmp_path / "anime.db"
151+
152+
# Setup the test db
153+
_setup_test_db(db_path)
154+
155+
# Monkeypatch the DB_PATH variable of retrieval_utils file
156+
monkeypatch.setattr(retrieval_utils, "DB_PATH", str(db_path))
157+
158+
# Execute the Method under Test
159+
result_json = get_recommendations([], limit=5)
160+
result = json.loads(result_json)
161+
162+
# Assert on the results
163+
assert len(result) == 0

0 commit comments

Comments
 (0)