Files
planeMapper/tests/test_basemap.py
T
Matt Edholm 037ce3e193 Implement story 2.2: coordinate projection and base map loading
Add MapBounds dataclass and equirectangular project() function in
projection.py, basemap.load() forcing pixels into memory via .copy(),
and full test coverage for both modules (4 new tests). All quality
gates pass: 67 tests, ruff clean.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 23:10:38 -04:00

23 lines
691 B
Python

from __future__ import annotations
import pytest
from PIL import Image
from planemapper.renderer import basemap
def test_load_returns_image(tmp_path, monkeypatch):
img_path = tmp_path / "background.png"
img = Image.new("RGB", (800, 480), color=(255, 255, 255))
img.save(img_path)
monkeypatch.setattr("planemapper.renderer.basemap.BACKGROUND_PATH", img_path)
result = basemap.load()
assert result.size == (800, 480)
def test_load_raises_if_missing(tmp_path, monkeypatch):
missing = tmp_path / "nonexistent.png"
monkeypatch.setattr("planemapper.renderer.basemap.BACKGROUND_PATH", missing)
with pytest.raises(FileNotFoundError):
basemap.load()