fix: import the ThinkingWire that __all__ already promised
The previous commit added the name to __all__ but never bound it, so `from polygateway import ThinkingWire` and `import *` both raised while the whole suite stayed green — the export test names symbols one by one, and nobody thought to add the new one. The guard is now the invariant rather than a longer list: every name in __all__ must be an attribute of the package.
This commit is contained in:
@@ -22,7 +22,12 @@ from polygateway.errors import (
|
|||||||
)
|
)
|
||||||
from polygateway.ocr import OcrClient
|
from polygateway.ocr import OcrClient
|
||||||
from polygateway.pricing import ModelPrice, PricingTable
|
from polygateway.pricing import ModelPrice, PricingTable
|
||||||
from polygateway.providers import DEFAULT_PROFILES, ProviderProfile, register_provider
|
from polygateway.providers import (
|
||||||
|
DEFAULT_PROFILES,
|
||||||
|
ProviderProfile,
|
||||||
|
ThinkingWire,
|
||||||
|
register_provider,
|
||||||
|
)
|
||||||
from polygateway.telemetry.schema import telemetry_schema_sql
|
from polygateway.telemetry.schema import telemetry_schema_sql
|
||||||
from polygateway.thinking import (
|
from polygateway.thinking import (
|
||||||
ThinkingCapability,
|
ThinkingCapability,
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ def test_thinking_public_surface_exported():
|
|||||||
"ThinkingCapability",
|
"ThinkingCapability",
|
||||||
"ThinkingObservation",
|
"ThinkingObservation",
|
||||||
"ThinkingUnsupportedError",
|
"ThinkingUnsupportedError",
|
||||||
|
"ThinkingWire",
|
||||||
"get_capability",
|
"get_capability",
|
||||||
"register_capability",
|
"register_capability",
|
||||||
"resolve_thinking",
|
"resolve_thinking",
|
||||||
@@ -74,3 +75,14 @@ def test_thinking_public_surface_exported():
|
|||||||
assert name in polygateway.__all__, name
|
assert name in polygateway.__all__, name
|
||||||
assert "observe_thinking" not in polygateway.__all__
|
assert "observe_thinking" not in polygateway.__all__
|
||||||
assert "reconcile_thinking" not in polygateway.__all__
|
assert "reconcile_thinking" not in polygateway.__all__
|
||||||
|
|
||||||
|
|
||||||
|
def test_every_promised_export_is_actually_importable():
|
||||||
|
"""`__all__` 里的每个名字都必须真的绑在包上。
|
||||||
|
|
||||||
|
只维护 `__all__` 而漏掉 import,`from polygateway import X` 与 `import *`
|
||||||
|
都会当场炸,而逐个点名的用例只覆盖它当时想到的符号——2026-09-04 的
|
||||||
|
`ThinkingWire` 正是这样漏进来的(在 `__all__` 里躺了一个提交却 import 不到)。
|
||||||
|
"""
|
||||||
|
missing = [name for name in polygateway.__all__ if not hasattr(polygateway, name)]
|
||||||
|
assert not missing, f"__all__ 承诺了但没绑上的符号: {missing}"
|
||||||
|
|||||||
Reference in New Issue
Block a user