Files
taraseidler f5cd79a40c in compute.py: Funktion project_ortho Implimentiert (für die orthographische Projektion eines 3D point)
test-projection ergänzt,nach Arrange/Act/Assert gegliedert, ohne und mit skalierung
2026-10-28 16:05:22 +01:00

36 lines
793 B
Python

"""Machine tests for the orthographic projection in compute.py.
Every test is structured according to the
Arrange - Act - Assert pattern.
"""
import pytest
from compute import project_ortho
def test_project_ortho_without_scale() -> None:
"""project_ortho drops z and returns (x, y) unchanged."""
# Arrange
point = (1.0, 2.0, 3.0)
expected = (1.0, 2.0)
# Act
result = project_ortho(point)
# Assert
assert result == pytest.approx(expected)
def test_project_ortho_with_scale_100() -> None:
"""project_ortho with scale=100 scales the projected point."""
# Arrange
point = (1.0, 2.0, 3.0)
scale = 100
expected = (100.0, 200.0)
# Act
result = project_ortho(point, scale)
# Assert
assert result == pytest.approx(expected)