TST: Fix TypeError arising only when using a sparse matrix in Python 3.3