Skip to content

Commit 43b6480

Browse files
committed
Create test file dynamically, rather than using hexedited file
1 parent 087376d commit 43b6480

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

-53.4 KB
Binary file not shown.

Tests/test_file_fits.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ def test_truncated_fits() -> None:
4444

4545

4646
def test_naxis_zero() -> None:
47-
# This test image has been manually hexedited
48-
# to set the number of data axes to zero
49-
with pytest.raises(ValueError):
50-
with Image.open("Tests/images/hopper_naxis_zero.fits"):
47+
image_data = b"".join(
48+
data.ljust(80, b" ") for data in [b"SIMPLE = T", b"NAXIS = 0", b"END"]
49+
).ljust(2881)
50+
with pytest.raises(ValueError, match="No image data"):
51+
with Image.open(BytesIO(image_data)):
5152
pass
5253

5354

0 commit comments

Comments
 (0)