Utilities for unit testing with images.
Project description
pyimagetest
pyimagetest
provides utilities for unit testing with images.
pyimagetest.ImageTestcase
is an ABC
meant for double inheritance with unittest.Testcase
. It adds the assertImagesAlmostEqual
method. The compared image objects do not have to be from the same pyimagetest.ImageBackend
. As long as the backend is known to pyimagetest.ImageTestcase
it is inferred automatically.
Currently the following ImageBackend
s are supported off-the-shelf:
imageio
PIL
Custom backends can be added by subclassing ImageBackend
.
Example usage
import unittest
import pyimagetest
class Tester(pyimagetest.ImageTestcase, unittest.TestCase):
@property
def default_test_image_file(self):
return "path/to/default/test/image/file"
def test_io(self):
imageio_image = self.load_image("imageio")
pil_image = self.load_image("PIL")
self.assertImagesAlmostEqual(imageio_image, pil_image)
if __name__ == "__main__":
unittest.main()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyimagetest-0.1.tar.gz
(4.0 kB
view hashes)
Built Distribution
pyimagetest-0.1-py3-none-any.whl
(16.9 kB
view hashes)
Close
Hashes for pyimagetest-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3bf09a9c1674bd2e6ff808970c0aa8999298da7895c42014513462ff9407792 |
|
MD5 | d032a9b7a6a0b201bd147c31abb83646 |
|
BLAKE2b-256 | 54aed476d6b4ff15b88aa02a9edf0e7abf854f659ce4259b46fb5a6d19618564 |