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)