[Numpy-svn] r8328 - trunk/numpy/core/tests

numpy-svn@scip... numpy-svn@scip...
Mon Apr 12 19:38:49 CDT 2010


Author: charris
Date: 2010-04-12 19:38:49 -0500 (Mon, 12 Apr 2010)
New Revision: 8328

Modified:
   trunk/numpy/core/tests/test_memmap.py
Log:
ENH: Add more tests for new memmap object attributes.

Modified: trunk/numpy/core/tests/test_memmap.py
===================================================================
--- trunk/numpy/core/tests/test_memmap.py	2010-04-12 23:34:55 UTC (rev 8327)
+++ trunk/numpy/core/tests/test_memmap.py	2010-04-13 00:38:49 UTC (rev 8328)
@@ -38,17 +38,31 @@
         del fp
         os.unlink(tmpname)
 
+    def test_attributes(self):
+        offset = 1
+        mode = "w+"
+        fp = memmap(self.tmpfp, dtype=self.dtype, mode=mode,
+                    shape=self.shape, offset=offset)
+        self.assertEquals(offset, fp.offset)
+        self.assertEquals(mode, fp.mode)
+        del fp
+
     def test_filename(self):
         tmpname = mktemp('','mmap')
         fp = memmap(tmpname, dtype=self.dtype, mode='w+',
                        shape=self.shape)
+        abspath = os.path.abspath(tmpname)
         fp[:] = self.data[:]
-        self.assertEquals(tmpname, fp.filename)
+        self.assertEquals(abspath, fp.filename)
         b = fp[:1]
-        self.assertEquals(tmpname, b.filename)
+        self.assertEquals(abspath, b.filename)
         del fp
         os.unlink(tmpname)
 
+    def test_filename_fileobj(self):
+        fp = memmap(self.tmpfp, dtype=self.dtype, mode="w+",
+                    shape=self.shape)
+        self.assertEquals(fp.filename, self.tmpfp.name)
 
     def test_flush(self):
         fp = memmap(self.tmpfp, dtype=self.dtype, mode='w+',



More information about the Numpy-svn mailing list