/
usr
/
lib64
/
python2.6
/
site-packages
/
numpy
/
core
/
tests
/
/usr/lib64/python2.6/site-packages/numpy/core/tests
mkdir
upload
Name
Size
Mode
Actions
data/
-
0755
rm
test_blasdot.py
465
0644
edit
dl
rm
test_blasdot.pyc
990
0644
edit
dl
rm
test_blasdot.pyo
990
0644
edit
dl
rm
test_defchararray.py
23583
0644
edit
dl
rm
test_defchararray.pyc
36847
0644
edit
dl
rm
test_defchararray.pyo
32392
0644
edit
dl
rm
test_dtype.py
3987
0644
edit
dl
rm
test_dtype.pyc
6546
0644
edit
dl
rm
test_dtype.pyo
6546
0644
edit
dl
rm
test_errstate.py
1712
0644
edit
dl
rm
test_errstate.pyc
1654
0644
edit
dl
rm
test_errstate.pyo
1654
0644
edit
dl
rm
test_function_base.py
984
0644
edit
dl
rm
test_function_base.pyc
2319
0644
edit
dl
rm
test_function_base.pyo
2017
0644
edit
dl
rm
test_getlimits.py
1630
0644
edit
dl
rm
test_getlimits.pyc
3799
0644
edit
dl
rm
test_getlimits.pyo
3799
0644
edit
dl
rm
test_machar.py
1000
0644
edit
dl
rm
test_machar.pyc
1705
0644
edit
dl
rm
test_machar.pyo
1705
0644
edit
dl
rm
test_memmap.py
2101
0644
edit
dl
rm
test_memmap.pyc
3341
0644
edit
dl
rm
test_memmap.pyo
3289
0644
edit
dl
rm
test_multiarray.py
51858
0644
edit
dl
rm
test_multiarray.pyc
70254
0644
edit
dl
rm
test_multiarray.pyo
69639
0644
edit
dl
rm
test_numeric.py
30773
0644
edit
dl
rm
test_numeric.pyc
48028
0644
edit
dl
rm
test_numeric.pyo
45970
0644
edit
dl
rm
test_numerictypes.py
14194
0644
edit
dl
rm
test_numerictypes.pyc
17908
0644
edit
dl
rm
test_numerictypes.pyo
17572
0644
edit
dl
rm
test_print.py
8091
0644
edit
dl
rm
test_print.pyc
9224
0644
edit
dl
rm
test_print.pyo
9224
0644
edit
dl
rm
test_records.py
5325
0644
edit
dl
rm
test_records.pyc
9183
0644
edit
dl
rm
test_records.pyo
8534
0644
edit
dl
rm
test_regression.py
43097
0644
edit
dl
rm
test_regression.pyc
67025
0644
edit
dl
rm
test_regression.pyo
62503
0644
edit
dl
rm
test_scalarmath.py
3789
0644
edit
dl
rm
test_scalarmath.pyc
5395
0644
edit
dl
rm
test_scalarmath.pyo
5096
0644
edit
dl
rm
test_shape_base.py
4571
0644
edit
dl
rm
test_shape_base.pyc
8890
0644
edit
dl
rm
test_shape_base.pyo
8326
0644
edit
dl
rm
test_ufunc.py
16944
0644
edit
dl
rm
test_ufunc.pyc
18366
0644
edit
dl
rm
test_ufunc.pyo
18135
0644
edit
dl
rm
test_umath.py
35991
0644
edit
dl
rm
test_umath.pyc
54765
0644
edit
dl
rm
test_umath.pyo
51377
0644
edit
dl
rm
test_umath_complex.py
17728
0644
edit
dl
rm
test_umath_complex.pyc
16886
0644
edit
dl
rm
test_umath_complex.pyo
16886
0644
edit
dl
rm
test_unicode.py
11255
0644
edit
dl
rm
test_unicode.pyc
15070
0644
edit
dl
rm
test_unicode.pyo
15070
0644
edit
dl
rm
Edit:
/usr/lib64/python2.6/site-packages/numpy/core/tests/test_memmap.py
(2101B)
from tempfile import NamedTemporaryFile, mktemp import os import warnings from numpy import memmap from numpy import arange, allclose from numpy.testing import * class TestMemmap(TestCase): def setUp(self): self.tmpfp = NamedTemporaryFile(prefix='mmap') self.shape = (3,4) self.dtype = 'float32' self.data = arange(12, dtype=self.dtype) self.data.resize(self.shape) def tearDown(self): self.tmpfp.close() 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) 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) 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) def test_del(self): # Make sure a view does not delete the underlying mmap fp_base = memmap(self.tmpfp, dtype=self.dtype, mode='w+', shape=self.shape) fp_view = fp_base[:] class ViewCloseError(Exception): pass _close = memmap._close def replace_close(self): raise ViewCloseError('View should not call _close on memmap') try: memmap._close = replace_close del fp_view finally: memmap._close = _close if __name__ == "__main__": run_module_suite()
Save
cmd:
run