40 lines
1.3 KiB
Python
40 lines
1.3 KiB
Python
"""包基线冒烟测试:可导入、版本号存在。"""
|
|
|
|
from pathlib import Path
|
|
|
|
import polygateway
|
|
|
|
|
|
def test_package_importable_with_version() -> None:
|
|
import tomllib
|
|
|
|
declared = tomllib.loads(Path("pyproject.toml").read_text())["project"]["version"]
|
|
assert polygateway.__version__ == declared # 单一版本源: 与 pyproject 同步
|
|
|
|
|
|
def test_ocr_public_surface_exported():
|
|
"""M3 OCR 公共 API 面(设计 §3;transport 结果与 Protocol 不出顶层)。"""
|
|
import polygateway
|
|
|
|
for name in (
|
|
"OcrClient",
|
|
"OcrSettings",
|
|
"OcrTextResult",
|
|
"OcrLayoutResult",
|
|
"OcrLayoutElement",
|
|
):
|
|
assert hasattr(polygateway, name), name
|
|
assert name in polygateway.__all__, name
|
|
|
|
|
|
def test_telemetry_schema_sql_exported():
|
|
"""issue #13: manual 档下游需要主动索取"库要求的最小 schema"的顶层入口。
|
|
|
|
同时钉住公共面**只增这一个名字**: `missing_columns_warning` 是 recorder 内部
|
|
共用的文案构造函数,导出它等于多一份永久承诺(库承诺公共面只增不删)。
|
|
"""
|
|
assert "telemetry_schema_sql" in polygateway.__all__
|
|
assert callable(polygateway.telemetry_schema_sql)
|
|
assert "missing_columns_warning" not in polygateway.__all__
|
|
assert not hasattr(polygateway, "missing_columns_warning")
|