/
koda
/
FiVI
Обзор
Документация
Войти
/
koda
/
FiVI
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
tests/test_runtime_contract.py
30 строк
999 B
koda
Prepare production-ready grasp planner
18 июл 2026, 09:39
18 июл 2026, 09:39
f540458
Код
Авторство
О чём код?
from __future__ import annotations import numpy as np import pytest from src.main import run from src.viewer import diagnostics def test_runtime_close_is_idempotent_and_blocks_rendering() -> None: runtime, _, _, _ = run("sphere", exact_evaluation=False) runtime.close() runtime.close() with pytest.raises(RuntimeError, match="runtime is closed"): runtime.get_camera_image() with pytest.raises(RuntimeError, match="runtime is closed"): runtime.get_camera_segmentation() def test_diagnostics_arrays_are_detached_and_immutable() -> None: runtime, _, result, _ = run("sphere", exact_evaluation=False) try: data = diagnostics(runtime, result.plans[0]) assert not data.contacts_world.flags.writeable assert not data.fingertips_world.flags.writeable assert not data.residuals_world.flags.writeable with pytest.raises(ValueError): data.contacts_world[0] = np.zeros(3) finally: runtime.close()