def test_streaming_hdu_write_file_like(self):

        arr = np.zeros((5, 5), dtype=np.int32)
        # The file-like object underlying a StreamingHDU must be in binary mode
        sf = BytesIO()
        shdu = self._make_streaming_hdu(sf)
        shdu.write(arr)
        assert shdu.writecomplete
        assert shdu.size == 100

        sf.seek(0)
        hdul = fits.open(sf)
        assert len(hdul) == 1
        assert (hdul[0].data == arr).all()
Test streaming an HDU to an open file-like object.
dataset/ETHPy150Open spacetelescope/PyFITS/pyfits/tests/test_core.py/TestStreamingFunctions.test_streaming_hdu_write_file_like