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>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user