FIX isfileobj accepts write-mode files under PY3

Under Python 3, files open in write mode were not recognized as file objects, triggering large memory copies with `np.save`.
please use `assert_` from `np.testing` or self.assertTrue
`assert` can get removed in optimized builds