Files
lidar_rendu/lidar_pipeline/tests/test_mapui.py
Antoine fb892ea9f2 Translate the whole project to English and fix outdated comments and help
Comments, docstrings, logs, CLI help, map UI, legends, PDF sheet, scripts,
compose files and AGENTS.md are now English. Data keys stay unchanged
(relief_oriente, densite_sol, visualisations/, API JSON keys, link params).
Wrong comments and help defaults found along the way are corrected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 23:16:45 +02:00

38 lines
1.3 KiB
Python

"""Interface loader: the package's web/ files, versions, JS syntax."""
import shutil
import subprocess
import pytest
def test_constants_are_read_from_web_files():
from lidar_pipeline import mapui
for name, text in (("map.html", mapui._MAP_HTML), ("map.css", mapui._MAP_CSS),
("map.js", mapui._MAP_JS)):
assert (mapui.WEB_DIR / name).read_text(encoding="utf-8") == text
def test_web_files_ship_with_installed_package():
# Full image: package installed by pip (package_data) — all three files
# must be there, otherwise the interface is empty in production.
import lidar_pipeline
from pathlib import Path
web = Path(lidar_pipeline.__file__).resolve().parent / "web"
for name in ("map.html", "map.css", "map.js"):
assert (web / name).is_file(), name
def test_markers_kept():
from lidar_pipeline import mapui
assert "__ASSETS_V__" in mapui._MAP_HTML
assert "__UI_VERSION__" in mapui._MAP_JS
assert "__ASSETS_V__" not in mapui.render_html()
@pytest.mark.skipif(shutil.which("node") is None, reason="node not installed")
def test_js_syntax():
from lidar_pipeline import mapui
res = subprocess.run(["node", "--check", str(mapui.WEB_DIR / "map.js")],
capture_output=True, text=True)
assert res.returncode == 0, res.stderr