from sympy import (symbols, FunctionMatrix, MatrixExpr, Lambda, Matrix)
from sympy.utilities.pytest import raises, XFAIL

def test_funcmatrix():
    i,j = symbols('i,j')
    X = FunctionMatrix(3,3, Lambda((i,j), i-j))
    assert X[1,1] == 0
    assert X[1,2] == -1
    assert X.shape == (3,3)
    assert X.rows == X.cols == 3
    assert Matrix(X) == Matrix(3, 3, lambda i,j : i-j)
    assert isinstance(X*X+X, MatrixExpr)
