예제 #1
0
    def test_roundtrip(self):
        # Write data to file
        fp = memmap(self.tmpfp, dtype=self.dtype, mode='w+',
                    shape=self.shape)
        fp[:] = self.data[:]
        del fp # Test __del__ machinery, which handles cleanup

        # Read data back from file
        newfp = memmap(self.tmpfp, dtype=self.dtype, mode='r',
                       shape=self.shape)
        assert allclose(self.data, newfp)
        assert_array_equal(self.data, newfp)
예제 #2
0
 def test_open_with_filename(self):
     tmpname = mktemp('','mmap')
     fp = memmap(tmpname, dtype=self.dtype, mode='w+',
                    shape=self.shape)
     fp[:] = self.data[:]
     del fp
     os.unlink(tmpname)
예제 #3
0
    def test_flush(self):
        fp = memmap(self.tmpfp, dtype=self.dtype, mode='w+', shape=self.shape)
        fp[:] = self.data[:]
        fp.flush()

        warnings.simplefilter('ignore', DeprecationWarning)
        fp.sync()
        warnings.simplefilter('default', DeprecationWarning)
예제 #4
0
    def test_flush(self):
        fp = memmap(self.tmpfp, dtype=self.dtype, mode='w+',
                    shape=self.shape)
        fp[:] = self.data[:]
        fp.flush()

        warnings.simplefilter('ignore', DeprecationWarning)
        fp.sync()
        warnings.simplefilter('default', DeprecationWarning)
예제 #5
0
 def test_open_with_filename(self):
     tmpname = mktemp('', 'mmap')
     fp = memmap(tmpname, dtype=self.dtype, mode='w+', shape=self.shape)
     fp[:] = self.data[:]
     del fp
     os.unlink(tmpname)