summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2010-04-13 00:38:49 +0000
committerCharles Harris <charlesr.harris@gmail.com>2010-04-13 00:38:49 +0000
commit20ccf3a5b25f25262bc2b23e092337ae4e7a4f1a (patch)
tree018c7c2a654afc3facc7bbb5aa5561b46f73b302 /numpy
parentb9ae90617de1b65dabe43ebc6effe29d4634abc9 (diff)
downloadnumpy-20ccf3a5b25f25262bc2b23e092337ae4e7a4f1a.tar.gz
ENH: Add more tests for new memmap object attributes.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/tests/test_memmap.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/numpy/core/tests/test_memmap.py b/numpy/core/tests/test_memmap.py
index fb1d7fa46..05163625b 100644
--- a/numpy/core/tests/test_memmap.py
+++ b/numpy/core/tests/test_memmap.py
@@ -38,17 +38,31 @@ class TestMemmap(TestCase):
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+',