First paragraph.
Second paragraph.
import os import tempfile import pytest from summarizer.utils import read_file, extract_from_url import requests def test_read_file_success(sample_text_file, sample_text): content = read_file(sample_text_file) assert content.strip() == sample_text.strip() def test_read_file_nonexistent(): with pytest.raises(Exception) as exc_info: read_file("nonexistent_file.txt") assert "File reading failed" in str(exc_info.value) def test_read_file_empty(): with tempfile.NamedTemporaryFile(mode='w', delete=False) as f: pass try: with pytest.raises(Exception) as exc_info: read_file(f.name) assert "File is empty" in str(exc_info.value) finally: os.unlink(f.name) def test_extract_from_url(requests_mock): url = "http://example.com" mock_html = """
First paragraph.
Second paragraph.