Skip to content

Commit

Permalink
issue #74, remove last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
JolanThomassin committed Mar 28, 2024
1 parent 8e48712 commit 9c8ff18
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions tests/test_db_generate_qna_crawl.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,21 @@ def test_generate_question_db_connection_fail(
json_template = "test json template"
mock_connect_db.return_value = None # Simulate a failed DB connection

# Call the function, but store its return value without unpacking
result = generate_question(
system_prompt,
user_prompt,
json_template,
project_db=None, # Pass None instead of the database connection
)
# Create a temporary directory
test_dir = tempfile.mkdtemp()

# Assert that the function returns None
self.assertIsNone(result)
try:
self.assertIsNone(
generate_question(
system_prompt,
user_prompt,
json_template,
mock_connect_db.return_value,
)
)
finally:
# Remove the temporary directory after the test
shutil.rmtree(test_dir)


if __name__ == "__main__":
Expand Down

0 comments on commit 9c8ff18

Please sign in to comment.