"""Bing's RSS answers as a search source (parsing only — no network).""" from __future__ import annotations import pytest from plyngent.lmproto.search import SearchHit from plyngent.tools.net.bing import parse_bing_rss DOCUMENT = """ 必应:DeepSeek Harness DeepSeek Harness v0.2 https://pandaily.com/deepseek-harness-v0-2 Desktop installers and a plugin manager. Sat, 03 Oct 2026 12:06:00 GMT No link here Dropped: a hit without a URL is nothing to read. Spaced title https://example.com/spaced """ def test_parse_bing_rss_maps_items_to_hits() -> None: hits = parse_bing_rss(DOCUMENT) assert hits == [ SearchHit( title="DeepSeek Harness v0.2", url="https://pandaily.com/deepseek-harness-v0-2", snippet="Desktop installers and a plugin manager.", ), SearchHit(title="Spaced title", url="https://example.com/spaced", snippet=""), ] def test_parse_bing_rss_rejects_a_non_rss_body() -> None: with pytest.raises(RuntimeError, match="unparseable XML"): _ = parse_bing_rss("rate limited")