Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/wrappers/python/tests/test_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,34 @@ def test_write_float(self):

os.remove(outfilename)

def test_unfinished_multipart_load(self):

#
# Multipart files may list more part headers than have valid
# pixel data (interrupted write). Loading should return only
# parts whose pixels read successfully, not fail the entire
# file open.
#
# The test file unfinished_multipart.exr has 4 parts, 2 valid
# and 2 invalid. The default read should return 2 parts; the
# header_only read should return all 4 parts.
#

path = f"{test_dir}/unfinished_multipart.exr"
num_parts = 4
num_good = 2

with OpenEXR.File(path, separate_channels=True) as f:
self.assertEqual(len(f.parts), num_good)
for i in range(num_good):
self.assertIn('Z', f.parts[i].channels)
self.assertEqual(f.parts[i].channels['Z'].pixels.shape, (8, 8))
self.assertEqual(f.parts[0].name(), 'Part0')
self.assertEqual(f.parts[1].name(), 'Part1')

with OpenEXR.File(path, separate_channels=True, header_only=True) as f:
self.assertEqual(len(f.parts), num_parts)

def test_write_2part(self):

#
Expand Down
Binary file not shown.
Loading