flashcard-studio / tests /test_pipeline.py
Nathan Slaughter
add pipeline method
2f264ab
raw
history blame
623 Bytes
import pytest
def test_generate_flashcards(pipeline, mocker):
"""
Test the generate_flashcards method of LanguageModel.
"""
prompt = "Sample prompt for flashcard generation."
expected_response = '{"flashcards": [{"Question": "What is AI?", "Answer": "Artificial Intelligence."}]}'
# Configure the mock to return a specific response
pipeline.generate_flashcards.return_value = expected_response
# Call the method
response = pipeline.generate_flashcards(prompt)
# Assertions
assert response == expected_response
pipeline.generate_flashcards.assert_called_once_with(prompt)