def test_transposed(self): assert Vector([1, 2, 3], transposed=True).transposed assert not Vector([1, 2, 3]).transposed assert Vector(Matrix([[1, 2, 3]])).transposed assert not Vector(Matrix([[1], [2], [3]])).transposed assert Vector([], transposed=True).transposed assert not Vector([]).transposed
def test_get(self): assert all( Matrix([[(0, 0), (0, 1)], [(1, 0), (1, 1)], [(2, 0), (2, 1)]])[x][y] == (x, y) for y in range(2) for x in range(3))
def test_constructor(self): Vector([1, 2, 3]) Vector([]) with raises(ValueError): Vector(Matrix([[1, 2, 3], [1, 2, 3]]))
def test_mul(self): assert Matrix([[1, 2], [3, 4], [5, 6]]) * Matrix( [[-1, -1, -1], [1, 1, 1]]) == Matrix([[1, 1, 1], [1, 1, 1], [1, 1, 1]]) with raises(ArithmeticError): Matrix.create_matrix(3, 1) * Matrix.create_matrix(3, 1)
def test_constructor(self): Matrix([[0, 0, 0], [0, 0, 0], [0, 0, 0]]) with raises(ValueError): Matrix([[0, 0, 0], [0, 0], [0, 0, 0]]) Matrix([]) Matrix([[], [], []])
def test_iter(self): assert tuple(vector[0] for vector in Matrix([[0], [1], [2]])) == (0, 1, 2)
def test_mn(self): assert Matrix([[0, 0], [0, 0], [0, 0]]).sizes == (3, 2) assert Matrix([]).sizes == (0, 0) assert Matrix([[], [], []]).sizes == (3, 0)