"""Tests for parser module."""
import pytest
from datetime import datetime
import pytz
from unittest.mock import patch
from src.rss_scraper.parser import sanitize_text, extract_articles_from_html
from src.rss_scraper.exceptions import ParseError
from src.rss_scraper.config import Config
class TestSanitizeText:
"""Test text sanitization functionality."""
def test_sanitize_normal_text(self):
"""Test sanitization of normal text."""
text = "Normal article title"
result = sanitize_text(text)
assert result == "Normal article title"
def test_sanitize_none_text(self):
"""Test sanitization of None text."""
result = sanitize_text(None)
assert result == "No title"
def test_sanitize_empty_text(self):
"""Test sanitization of empty text."""
result = sanitize_text("")
assert result == "No title"
def test_sanitize_whitespace_text(self):
"""Test sanitization of whitespace-only text."""
result = sanitize_text(" ")
assert result == "No title"
def test_remove_dangerous_patterns(self):
"""Test removal of dangerous patterns."""
dangerous_text = "Title with content"
result = sanitize_text(dangerous_text)
assert "