25 lines
705 B
Python
25 lines
705 B
Python
"""离线 mock 档位:纯内存仿真,CI / 单测必跑。"""
|
||
|
||
from __future__ import annotations
|
||
|
||
from .base import AdapterBase, ExampleItem, ExampleResult
|
||
|
||
|
||
class MockAdapter(AdapterBase):
|
||
name = "mock"
|
||
|
||
def do_batch(self, target: str, items: list[ExampleItem]) -> ExampleResult:
|
||
if not items:
|
||
return ExampleResult(
|
||
ok=False,
|
||
serial_no=None,
|
||
error_msg="empty batch",
|
||
artifacts={},
|
||
)
|
||
return ExampleResult(
|
||
ok=True,
|
||
serial_no=f"MOCK-{len(items)}",
|
||
error_msg=None,
|
||
artifacts={"mode": "mock", "target": target, "count": len(items)},
|
||
)
|