Skip to content

Commit 1aa70c6

Browse files
Copilotgkorland
andcommitted
Add guard against division by zero in test
- Add assertion to check len(scores) > 0 before calculating average - Prevents potential ZeroDivisionError if no test cases are run Co-authored-by: gkorland <753206+gkorland@users.noreply.github.com>
1 parent d80ada4 commit 1aa70c6

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tests/test_rag.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ def test_movie_actor_queries(self, knowledge_graph_setup, delete_kg):
201201
delete_kg(kg)
202202

203203
# Verify that the average score meets the threshold
204+
assert len(scores) > 0, "No scores were collected"
204205
average_score = sum(scores) / len(scores)
205206
logger.info(f"Average Score: {average_score}")
206207
assert average_score >= 0.5, f"Average score {average_score} is below threshold of 0.5"

0 commit comments

Comments
 (0)