Skip to content

Commit dbba587

Browse files
committed
Added tests of memmap and character_as_bytes
1 parent cbb48a8 commit dbba587

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

‎astropy/io/fits/tests/test_connect.py‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,25 @@ def test_read_with_nonstandard_units(self):
147147
t = Table.read(hdu)
148148
assert equal_data(t, self.data)
149149

150+
def test_memmap(self, tmpdir):
151+
filename = str(tmpdir.join('test_simple.fts'))
152+
t1 = Table(self.data)
153+
t1.write(filename, overwrite=True)
154+
t2 = Table.read(filename, memmap=False)
155+
t3 = Table.read(filename, memmap=True)
156+
assert equal_data(t2, t3)
157+
158+
@pytest.mark.parametrize('memmap', (False, True))
159+
def test_character_as_bytes(self, tmpdir, memmap):
160+
filename = str(tmpdir.join('test_simple.fts'))
161+
t1 = Table(self.data)
162+
t1.write(filename, overwrite=True)
163+
t2 = Table.read(filename, character_as_bytes=False, memmap=memmap)
164+
t3 = Table.read(filename, character_as_bytes=True, memmap=memmap)
165+
assert t2['b'].dtype.kind == 'U'
166+
assert t3['b'].dtype.kind == 'S'
167+
assert equal_data(t2, t3)
168+
150169

151170
class TestMultipleHDU:
152171

0 commit comments

Comments
 (0)