Skip to content

Commit ad51377

Browse files
committed
Use type() checks instead of isinstance in matmul tests
Replaces isinstance checks with type() comparisons for MatrixExpr in matrix matmul return type tests to ensure exact type matching.
1 parent b38481a commit ad51377

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/test_matrix_variable.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,12 +400,12 @@ def test_matrix_matmul_return_type():
400400

401401
# test 1D @ 1D → 0D
402402
x = m.addMatrixVar(3)
403-
assert isinstance(x @ x, MatrixExpr)
403+
assert type(x @ x) is MatrixExpr
404404

405405
# test 1D @ 1D → 2D
406-
assert isinstance(x[:, None] @ x[None, :], MatrixExpr)
406+
assert type(x[:, None] @ x[None, :]) is MatrixExpr
407407

408408
# test 2D @ 2D → 2D
409409
y = m.addMatrixVar((3, 4))
410410
z = m.addMatrixVar((2, 3))
411-
assert isinstance(y @ z, MatrixExpr)
411+
assert type(y @ z) is MatrixExpr

0 commit comments

Comments
 (0)