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
This commit is contained in:
1 parent
3a5bbedad1
commit
f5cd79a40c
1 file changed
+36
@@ -0,0 +1,36 @@
|
||||
"""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)
|
||||
Reference in new issue
Block a user