Use warning instead of assert when matrix is not valid
Example text in test moved to separate file
PEP8