Add ty to check for missing symbols and other simple errors

This commit is contained in:
Andrej730
2026-03-20 15:35:53 +05:00
parent 30551cb288
commit 26280d24fe
41 changed files with 350 additions and 70 deletions
@@ -41,7 +41,7 @@ from ifcopenshell.util.shape_builder import (
class TestMathutilsCompatibleMethods(test.bootstrap.IFC4):
def test_np_rotation_matrix(self):
from mathutils import Matrix, Vector # pyright: ignore[reportMissingImports]
from mathutils import Matrix, Vector # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
# 2D.
assert np.allclose(Matrix.Rotation(radians(45), 2), np_rotation_matrix(radians(45), 2))
@@ -62,7 +62,7 @@ class TestMathutilsCompatibleMethods(test.bootstrap.IFC4):
assert np.allclose(Matrix.Rotation(*rotation_vector_args), np_rotation_matrix(*rotation_vector_args))
def test_np_matrix_to_euler(self):
from mathutils import Euler # pyright: ignore[reportMissingImports]
from mathutils import Euler # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
# Test 3x3.
rot = Euler((0.5, 0.5, 0.5)).to_matrix()
@@ -77,7 +77,7 @@ class TestMathutilsCompatibleMethods(test.bootstrap.IFC4):
assert np.allclose(rot.to_euler(), np_matrix_to_euler(V(rot)))
def test_np_angle(self):
from mathutils import Vector # pyright: ignore[reportMissingImports]
from mathutils import Vector # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
v1, v2 = (1, 0, 0), (0, 1, 0)
angle = np_angle(v1, v2)
@@ -100,7 +100,7 @@ class TestMathutilsCompatibleMethods(test.bootstrap.IFC4):
assert is_x(angle, radians(90))
def test_np_normal(self):
import mathutils.geometry # pyright: ignore[reportMissingImports]
import mathutils.geometry # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
vectors = (0, 0, 0), (1, 0, 0), (0, 1, 0)
n = mathutils.geometry.normal(vectors)
@@ -113,7 +113,7 @@ class TestMathutilsCompatibleMethods(test.bootstrap.IFC4):
assert np.allclose(n, (0, 0, -1))
def test_np_intersect_line_line(self):
import mathutils.geometry # pyright: ignore[reportMissingImports]
import mathutils.geometry # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
p1, p2 = [0, 0, 0], [1, 1, 1]
q1, q2 = [0, 1, 0], [1, 0, 1]