Skip to content

Commit

Permalink
Resolve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
addisonElliott committed Jan 27, 2019
1 parent 9978b10 commit 07d2227
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions nrrd/tests/test_writing.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,21 +184,23 @@ def test_write_fake_encoding(self):

def test_write_detached_raw(self):
output_filename = os.path.join(self.temp_write_dir, 'testfile_detached_raw.nhdr')
output_data_filename = os.path.join(self.temp_write_dir, 'testfile_detached_raw.raw')

# Data & header are still detached even though detached_header is False because the filename is .nhdr
# Test also checks detached data filename that it is relative (default value)
nrrd.write(output_filename, self.data_input, {u'encoding': 'raw'}, detached_header=False)

# Read back the same file
data, header = nrrd.read(output_filename)
self.assertEqual(self.expected_data, data.tostring(order='F'))
self.assertEqual(header['encoding'], 'raw')
self.assertEqual(header['data file'], output_data_filename)
self.assertEqual(header['data file'], 'testfile_detached_raw.raw')

def test_write_detached_gz(self):
output_filename = os.path.join(self.temp_write_dir, 'testfile_detached_raw.nhdr')
output_data_filename = os.path.join(self.temp_write_dir, 'testfile_detached_raw.raw.gz')

# Data & header are still detached even though detached_header is False because the filename is .nhdr
# Test also checks detached data filename that it is absolute
nrrd.write(output_filename, self.data_input, {u'encoding': 'gz'}, detached_header=False,
relative_data_path=False)

Expand All @@ -212,6 +214,7 @@ def test_write_detached_bz2(self):
output_filename = os.path.join(self.temp_write_dir, 'testfile_detached_raw.nhdr')

# Data & header are still detached even though detached_header is False because the filename is .nhdr
# Test also checks detached data filename that it is relative (default value)
nrrd.write(output_filename, self.data_input, {u'encoding': 'bz2'}, detached_header=False)

# Read back the same file
Expand All @@ -224,6 +227,7 @@ def test_write_detached_ascii(self):
output_filename = os.path.join(self.temp_write_dir, 'testfile_detached_raw.nhdr')

# Data & header are still detached even though detached_header is False because the filename is .nhdr
# Test also checks detached data filename that it is relative (default value)
nrrd.write(output_filename, self.data_input, {u'encoding': 'txt'}, detached_header=False)

# Read back the same file
Expand Down

0 comments on commit 07d2227

Please sign in to comment.