"""Tests for openai4s.webtools — HTML → markdown conversion and the multi-engine web_search (engine fallback, dedup, scholarly identifier routing). All search tests stub `_http_get`, so nothing touches the network. Also keeps regression coverage for the arXiv /abs/ bug where `_html_to_markdown` dropped the abstract (bare text inside
) and the author list ( links inside
), returning only the title plus page boilerplate. """ import json from pathlib import Path from urllib.parse import urlparse import pytest from openai4s import webtools from openai4s.webtools import _html_to_markdown pytest.importorskip("bs4") _FIXTURES = Path(__file__).parent / "fixtures" def _arxiv_abs_html() -> str: # `.html.capture`, not `.html`: CodeQL's JavaScript extractor analyses # `.html` files, and this byte-exact arXiv page contains a CDN