docs: document Tencent quote refresh

This commit is contained in:
王鹏
2026-07-08 22:06:39 +08:00
parent 93e548d8a7
commit f7ef52ef64
3 changed files with 28 additions and 1 deletions

View File

@@ -64,3 +64,13 @@ def test_provider_builds_batch_query_and_maps_by_code():
assert "q=sz000001" in calls[0]
assert quotes["000001"].price == Decimal("10.60")
def test_provider_wraps_fetch_errors():
def failing_fetch(url: str, timeout: float) -> bytes:
raise OSError("bad gateway")
provider = TencentQuoteProvider(fetcher=failing_fetch)
with pytest.raises(QuoteFetchError, match="Tencent quote request failed"):
provider.fetch_quotes([Instrument(id=1, code="000001", name="平安银行")])