switched to using numpy.testing methods where possible, code formatting