From d78e4513aa5fa42673ff4eca996fc99298fb4191 Mon Sep 17 00:00:00 2001 From: Nodar Gogoberidze Date: Thu, 21 Nov 2024 11:18:27 -0500 Subject: [PATCH] Add tests for all sizes of integer types --- pytest.ini | 2 +- tests/core/core/reader/test__reader.py | 108 +++++++++++++++++++++++++ 2 files changed, 109 insertions(+), 1 deletion(-) diff --git a/pytest.ini b/pytest.ini index f91b4bcf8e..c38c636f88 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,6 +1,6 @@ [pytest] minversion = 6.0.0 -addopts = -v --tb=long --show-capture=all --capture=no --color=yes --code-highlight=yes +addopts = -q --tb=long --show-capture=all --capture=no --color=yes --code-highlight=yes log_cli_level = 10 testpaths = ./tests/frontend diff --git a/tests/core/core/reader/test__reader.py b/tests/core/core/reader/test__reader.py index 392b3adb9a..1268c774f4 100644 --- a/tests/core/core/reader/test__reader.py +++ b/tests/core/core/reader/test__reader.py @@ -103,6 +103,114 @@ def idfn(fixture_value): "start": 0, "stop": 1, }, + { + "img_ext": "tiff", + "img_name": "uint16_full_range", + "dtype": "uint16", + "divisor": numpy.float32(2**16-1), + "shift": 0, + "start": numpy.iinfo("uint16").min, + "stop": numpy.iinfo("uint16").max, + }, + { + "img_ext": "tiff", + "img_name": "uint16_partial_range", + "dtype": "uint16", + "divisor": numpy.float32(2**16-1), + "shift": 0, + "start": 255, + "stop": 10_000, + }, + { + "img_ext": "tiff", + "img_name": "uint16_smallest_range", + "dtype": "uint16", + "divisor": numpy.float32(2**16-1), + "shift": 0, + "start": 0, + "stop": 1, + }, + { + "img_ext": "tiff", + "img_name": "int16_full_range", + "dtype": "int16", + "divisor": numpy.float32(2**16-1), + "shift": numpy.iinfo("int16").min, + "start": numpy.iinfo("int16").min, + "stop": numpy.iinfo("int16").max, + }, + { + "img_ext": "tiff", + "img_name": "int16_partial_range", + "dtype": "int16", + "divisor": numpy.float32(2**16-1), + "shift": numpy.iinfo("int16").min, + "start": -10, + "stop": 10, + }, + { + "img_ext": "tiff", + "img_name": "int16_smallest_range", + "dtype": "int16", + "divisor": numpy.float32(2**16-1), + "shift": numpy.iinfo("int16").min, + "start": 0, + "stop": 1, + }, + { + "img_ext": "tiff", + "img_name": "uint32_full_range", + "dtype": "uint32", + "divisor": numpy.float32(2**32-1), + "shift": 0, + "start": numpy.iinfo("uint32").min, + "stop": numpy.iinfo("uint32").max, + }, + { + "img_ext": "tiff", + "img_name": "uint32_partial_range", + "dtype": "uint32", + "divisor": numpy.float32(2**32-1), + "shift": 0, + "start": 65535, + "stop": 1_000_000_000, + }, + { + "img_ext": "tiff", + "img_name": "uint32_smallest_range", + "dtype": "uint32", + "divisor": numpy.float32(2**32-1), + "shift": 0, + "start": 0, + "stop": 1, + }, + { + "img_ext": "tiff", + "img_name": "int32_full_range", + "dtype": "int32", + "divisor": numpy.float32(2**32-1), + "shift": numpy.iinfo("int32").min, + "start": numpy.iinfo("int32").min, + "stop": numpy.iinfo("int32").max, + }, + { + "img_ext": "tiff", + "img_name": "int32_partial_range", + "dtype": "int32", + "divisor": numpy.float32(2**32-1), + "shift": numpy.iinfo("int32").min, + "start": -65_536, + "stop": 65_536, + }, + { + "img_ext": "tiff", + "img_name": "int32_smallest_range", + "dtype": "int32", + "divisor": numpy.float32(2**32-1), + "shift": numpy.iinfo("int32").min, + "start": 0, + "stop": 1, + }, ]) def monochrome_image(request): shift = request.param["shift"]