def test_Matrix(): assert mathematica_code(Matrix()) == '{}' m = Matrix([[1, 2], [3, 4444]]) assert mathematica_code(m) == mathematica_code(m.as_immutable()) == '{{1, 2}, {3, 4444}}' m = SparseMatrix(m) assert mathematica_code(m) == mathematica_code(m.as_immutable()) == '{{1, 2}, {3, 4444}}'
def test_as_immutable(): X = Matrix([[1, 2], [3, 4]]) assert sympify(X) == X.as_immutable() == ImmutableMatrix([[1, 2], [3, 4]]) X = SparseMatrix(5, 5, {}) assert sympify(X) == X.as_immutable() == ImmutableSparseMatrix( [[0 for i in range(5)] for i in range(5)])