Skip to content

Commit 571c14d

Browse files
committed
[test] Add a smoke test for all known file types
Try to read an empty file and check that the right kind of exception is raised. This commit constitutes release 1.7.0.
1 parent 6de1b36 commit 571c14d

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

imsize/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.6.4"
1+
__version__ = "1.7.0"

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "imsize"
3-
version = "1.6.4"
3+
version = "1.7.0"
44
description="Lightning-fast extraction of basic image metadata"
55
authors = [{name = "Tomi Aarnio", email = "[email protected]"}]
66
readme = "README.md"

test/test_read.py

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33
import glob
44
import unittest
5+
import tempfile
56
import imsize
67

78

@@ -146,6 +147,12 @@ def test_orientations(self):
146147
self.assertEqual(info.nbytes, 600 * 450 * 3)
147148
self.assertEqual(info.orientation, (i % 8) + 1)
148149

150+
def test_empty_files(self):
151+
for ext in imsize.FILETYPES:
152+
with tempfile.NamedTemporaryFile(suffix=ext) as fp:
153+
with self.assertRaises(imsize.ImageFileError):
154+
info = imsize.read(fp.name)
155+
149156

150157
if __name__ == "__main__":
151158
unittest.main()

0 commit comments

Comments
 (0)