Pillow/Tests
Yay295 3af0e2d9cf add "new" rawmodes for 16-bit RGB data
The existing 16-bit RGB rawmodes do not follow the naming convention given in Unpack.c. These new modes do follow that convention, except since these modes do not all use the same number of bits for each band, the sizes of each band are listed.

Old → New
RGB;15 → XBGR;1555
RGB;16 → BGR;565
BGR;5 → XRGB;1555
BGR;15 → XRGB;1555
BGR;16 → RGB;565
RGB;4B → XBGR;4
RGBA;4B → ABGR;4
RGBA;15 → ABGR;1555
BGRA;15 → ARGB;1555
BGRA;15Z → ARGB;1555Z

These new rawmodes also use a slightly different conversion method. The most accurate conversion from 5 to 8 bits is "round(x * 255 / 31.0)". However, that involves floating point numbers and rounding, so it's not as fast. The current method doesn't include the rounding, allowing us to also use integer instead of floating point division. This is faster, but unfortunately not roundtrippable - when converting from 5 to 8 to 5 bits not every value stays the same. The new method is roundtrippable, even faster than the current method since it uses basic bitwise operations instead of multiplication and division, and if you compare the result to what you get with rounding and floating point numbers, it is actually more accurate.
2024-10-12 18:33:57 -05:00
..
fonts
icc
images Test ignoring second ImageData 2024-10-05 16:28:03 -05:00
oss-fuzz
__init__.py
32bit_segfault_check.py
check_fli_oob.py
check_fli_overflow.py
check_icns_dos.py
check_imaging_leaks.py
check_j2k_dos.py
check_j2k_leaks.py
check_j2k_overflow.py
check_jp2_overflow.py
check_jpeg_leaks.py
check_large_memory_numpy.py
check_large_memory.py
check_libtiff_segfault.py
check_png_dos.py
check_release_notes.py
check_wheel.py
conftest.py
createfontdatachunk.py
helper.py
README.rst
test_000_sanity.py
test_binary.py
test_bmp_reference.py
test_box_blur.py Return early if either width or height is zero 2024-09-05 15:46:54 +10:00
test_color_lut.py
test_core_resources.py
test_decompression_bomb.py
test_deprecate.py
test_features.py Always raise warnings for deprecated feature checks 2024-10-11 20:59:15 +11:00
test_file_apng.py Use transparency when combining P frames 2024-10-06 11:30:27 +11:00
test_file_blp.py
test_file_bmp.py
test_file_bufrstub.py
test_file_container.py
test_file_cur.py
test_file_dcx.py
test_file_dds.py
test_file_eps.py Test ignoring second ImageData 2024-10-05 16:28:03 -05:00
test_file_fits.py
test_file_fli.py
test_file_fpx.py
test_file_ftex.py
test_file_gbr.py
test_file_gd.py
test_file_gif.py Improved handling of RGBA palettes when saving GIF images 2024-09-10 18:50:06 +10:00
test_file_gimpgradient.py
test_file_gimppalette.py
test_file_gribstub.py
test_file_hdf5stub.py
test_file_icns.py Deprecate setting size to (width, height, scale) 2024-09-06 11:42:56 +10:00
test_file_ico.py
test_file_im.py
test_file_imt.py
test_file_iptc.py
test_file_jpeg.py Added type hints to frombuffer 2024-09-06 15:16:59 +10:00
test_file_jpeg2k.py
test_file_libtiff_small.py
test_file_libtiff.py
test_file_mcidas.py
test_file_mic.py
test_file_mpeg.py
test_file_mpo.py
test_file_msp.py
test_file_palm.py
test_file_pcd.py
test_file_pcx.py
test_file_pdf.py
test_file_pixar.py
test_file_png.py
test_file_ppm.py
test_file_psd.py
test_file_qoi.py
test_file_sgi.py
test_file_spider.py
test_file_sun.py
test_file_tar.py
test_file_tga.py
test_file_tiff_metadata.py rewrite some comments 2024-09-20 08:39:11 -05:00
test_file_tiff.py Added additional test 2024-09-25 20:37:41 +10:00
test_file_wal.py
test_file_webp_alpha.py
test_file_webp_animated.py
test_file_webp_lossless.py
test_file_webp_metadata.py
test_file_webp.py Test unsupported image mode 2024-09-21 16:02:23 +10:00
test_file_wmf.py
test_file_xbm.py
test_file_xpm.py
test_file_xvthumb.py
test_font_bdf.py
test_font_crash.py
test_font_leaks.py
test_font_pcf_charsets.py
test_font_pcf.py
test_fontfile.py
test_format_hsv.py
test_format_lab.py
test_image_access.py
test_image_array.py Merge branch 'python-pillow:main' into type_comparison 2024-09-05 13:31:36 +02:00
test_image_convert.py
test_image_copy.py Use transposed size after opening for TIFF images 2024-09-18 20:26:06 +10:00
test_image_crop.py
test_image_draft.py
test_image_entropy.py
test_image_filter.py Support BuiltinFilter for I;16* images 2024-10-05 01:12:51 +10:00
test_image_frombytes.py
test_image_fromqimage.py
test_image_getbands.py
test_image_getbbox.py
test_image_getcolors.py
test_image_getdata.py
test_image_getextrema.py
test_image_getim.py Apply suggestions from code review 2024-10-07 13:05:13 +04:00
test_image_getpalette.py
test_image_getprojection.py
test_image_histogram.py
test_image_load.py
test_image_mode.py
test_image_paste.py
test_image_point.py
test_image_putalpha.py
test_image_putdata.py
test_image_putpalette.py
test_image_quantize.py
test_image_reduce.py
test_image_resample.py
test_image_resize.py Set default resize sampling for I;16* images to BICUBIC 2024-09-28 15:35:42 +10:00
test_image_rotate.py
test_image_split.py
test_image_thumbnail.py Use transposed size after opening for TIFF images 2024-09-18 20:26:06 +10:00
test_image_tobitmap.py
test_image_tobytes.py
test_image_transform.py
test_image_transpose.py
test_image.py Lint: Run PT016 2024-09-14 20:59:02 +10:00
test_imagechops.py
test_imagecms.py Support converting more modes to LAB by converting to RGBA first 2024-09-07 12:14:30 +10:00
test_imagecolor.py
test_imagedraw.py Accept float stroke widths 2024-09-11 19:53:52 +10:00
test_imagedraw2.py
test_imageenhance.py
test_imagefile.py Added type hints to frombuffer 2024-09-06 15:16:59 +10:00
test_imagefont.py Merge branch 'main' into improve-error-messages 2024-09-11 17:11:52 +02:00
test_imagefontctl.py
test_imagefontpil.py
test_imagegrab.py
test_imagemath_lambda_eval.py
test_imagemath_unsafe_eval.py
test_imagemorph.py Load before trying to catch exceptions 2024-09-21 16:22:50 +10:00
test_imageops_usm.py
test_imageops.py
test_imagepalette.py
test_imagepath.py Raise an error if path is compacted during mapping 2024-09-30 19:50:08 +10:00
test_imageqt.py
test_imagesequence.py
test_imageshow.py Fixed unclosed file warning 2024-10-07 16:50:05 +11:00
test_imagestat.py
test_imagetk.py
test_imagewin_pointers.py
test_imagewin.py Cast handle to int 2024-09-16 08:23:26 +10:00
test_lib_image.py
test_lib_pack.py add "new" rawmodes for 16-bit RGB data 2024-10-12 18:33:57 -05:00
test_locale.py
test_main.py
test_map.py
test_mode_i16.py
test_numpy.py Use transposed size after opening for TIFF images 2024-09-18 20:26:06 +10:00
test_pdfparser.py
test_pickle.py move eps test images to their own folder 2024-09-30 08:23:26 -05:00
test_psdraw.py
test_pyroma.py
test_qt_image_qapplication.py
test_qt_image_toqimage.py
test_sgi_crash.py
test_shell_injection.py
test_tiff_crashes.py
test_tiff_ifdrational.py
test_uploader.py
test_util.py
test_webp_leaks.py

Pillow Tests
============

Test scripts are named ``test_xxx.py``. Helper classes and functions can be found in ``helper.py``.

Dependencies
------------

Install::

    python3 -m pip install pytest pytest-cov pytest-timeout

Execution
---------

To run an individual test::

    pytest Tests/test_image.py

Or::

    pytest -k test_image.py

Run all the tests from the root of the Pillow source distribution::

    pytest

Or with coverage::

    pytest --cov PIL --cov Tests --cov-report term
    coverage html
    open htmlcov/index.html