Skip to content

Commit 930b4c5

Browse files
committed
test: add dataWindow validation checks #2023
Signed-off-by: haseeb khan <[email protected]>
1 parent 3e84f3e commit 930b4c5

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/wrappers/python/tests/test_exceptions.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,21 @@ def test_Part(self):
118118
self.assertEqual(p.type(), OpenEXR.tiledimage)
119119
self.assertEqual(p.compression(), OpenEXR.NO_COMPRESSION)
120120

121+
def test_InvalidDataWindow(self):
122+
"""Test that an invalid dataWindow raises an exception."""
123+
124+
invalid_header = {
125+
"dataWindow": (-5, -5, -1, -1), # Invalid rectangle
126+
"compression": OpenEXR.ZIP_COMPRESSION,
127+
"type": OpenEXR.scanlineimage
128+
}
129+
130+
RGB = np.random.rand(10, 10, 3).astype(np.float32) # Valid shape for data
131+
132+
with self.assertRaises(Exception):
133+
with OpenEXR.File(invalid_header, {"RGB": RGB}) as outfile:
134+
outfile.write("invalid_output.exr")
135+
121136
def test_Channel(self):
122137

123138
with self.assertRaises(Exception):

0 commit comments

Comments
 (0)