Replace len(X.shape) with X.ndim
Fixed tests: lists had no shape attr