Commit Graph

50 Commits

Author SHA1 Message Date
Aarni Koskela
8ca53b312d Enforce CSV parametrize names style 2024-08-07 12:27:20 +03:00
Andrew Murray
4ce06aac3b Added type hints 2024-02-12 23:01:44 +11:00
Hugo van Kemenade
4a4b90c365
Autotype tests (#7756)
* autotyping: --none-return
* autotyping: --scalar-return
* autotyping: --int-param
* autotyping: --float-param
* autotyping: --str-param
* autotyping: --annotate-named-param tmp_path:pathlib.Path
2024-01-31 20:12:58 +11:00
Hugo van Kemenade
53c3cd9f8e isort Tests 2024-01-20 13:23:03 +02:00
Hugo van Kemenade
43b2f61e79 Add 'from __future__ import annotations' using Ruff/isort 2023-12-21 13:13:31 +02:00
Andrew Murray
472eb66683 Skip tests that require FreeType if FreeType is not available 2023-08-24 19:02:27 +10:00
Andrew Murray
9979a822c7 Changed Image mode property to be read-only by default 2023-07-29 09:28:18 +10:00
pre-commit-ci[bot]
24183d652e [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2023-02-06 19:27:19 +00:00
Andrew Murray
c259ac492f Parametrized tests 2022-10-03 16:57:42 +11:00
Andrew Murray
3af00edc85 Added context managers 2021-11-25 23:16:07 +11:00
Hugo van Kemenade
18d34b287f Add support for pickling TrueType fonts 2021-11-10 14:34:20 +02:00
Hugo van Kemenade
dd87dd50c0 Update to isort 5 with Black profile support 2020-08-08 22:39:29 +03:00
Hugo van Kemenade
ddebe27eed
Merge pull request #4565 from radarhere/tiff_pickle
Fixed bug when unpickling TIFF images
2020-04-17 19:03:02 +03:00
Andrew Murray
9956a6c777 Fixed bug when unpickling TIFF images 2020-04-17 22:13:14 +10:00
Andrew Murray
76d96b6383 Removed default arguments from helper functions 2020-04-17 21:57:11 +10:00
Andrew Murray
e52b8cefe1 Skip test if webp is not available 2020-04-17 20:08:10 +10:00
Hugo
94751da23e Initialise __physical_frame = 0 and add pickle roundtrip tell test 2020-04-17 11:21:57 +03:00
Hugo
913e79f010 Test the modes 2020-04-16 15:52:10 +03:00
Hugo
5529aba441 Skip webp test when webp not available 2020-04-16 12:56:12 +03:00
Hugo
cdf3c98103 Add failing test for pickling webp 2020-04-16 11:45:12 +03:00
Hugo
d62b9098dd Refactor other tests into test_pickle_image 2020-04-16 11:44:28 +03:00
Hugo
53a85f2a69 Refactor test_pickle_image to use pytest.mark.parametrize 2020-04-16 11:31:28 +03:00
Andrew Murray
7ff2db143d Removed use of PillowTestCase 2020-03-23 07:05:51 +11:00
Andrew Murray
8482919a37 Converted most assert statements to pytest 2020-02-23 00:06:21 +11:00
Jon Dufresne
9e856b8a72 Remove testing of Python-2-only cPickle module
In Python 3, cPickle and pickle have been merged to a single module.

From https://docs.python.org/3/whatsnew/3.0.html#library-changes

> A common pattern in Python 2.x is to have one version of a module
> implemented in pure Python, with an optional accelerated version
> implemented as a C extension; for example, pickle and cPickle. This
> places the burden of importing the accelerated version and falling
> back on the pure Python version on each user of these modules. In
> Python 3.0, the accelerated versions are considered implementation
> details of the pure Python versions. Users should always import the
> standard version, which attempts to import the accelerated version and
> falls back to the pure Python version. The pickle / cPickle pair
> received this treatment.

Can now move the 'import pickle' to the top of the test file.
2020-02-17 10:27:36 -08:00
Andrew Murray
c0048ad7de Use context managers 2019-11-26 07:03:23 +11:00
Jon Dufresne
d50445ff30 Introduce isort to automate import ordering and formatting
Similar to the recent adoption of Black. isort is a Python utility to
sort imports alphabetically and automatically separate into sections. By
using isort, contributors can quickly and automatically conform to the
projects style without thinking. Just let the tool do it.

Uses the configuration recommended by the Black to avoid conflicts of
style.

Rewrite TestImageQt.test_deprecated to no rely on import order.
2019-07-06 16:11:35 -07:00
Hugo
5631718a8d Format with Black 2019-06-13 18:54:46 +03:00
Andrew Murray
e9c0cf61f3 Fixed palette for LA and PA mode when pickling 2019-05-11 14:43:00 +10:00
Hugo
65c55402b9
Merge pull request #3537 from radarhere/pickle
Fixed pickling of iTXt class with protocol > 1
2019-02-20 11:50:30 +02:00
Jon Dufresne
4de5477b61 Remove unnecessary unittest.main() boilerplate from test files
With the introduction and use of pytest, it is simple and easy to
execute specific tests in isolation through documented command line
arguments. Either by specifying the module path or through the `-k
EXPRESSION` argument. There is no longer any need to provide the
boilerplate:

    if __name__ == '__main__':
        unittest.main()

To every test file. It is simply noise.

The pattern remains in test files that aren't named with `test_*` as
those files are not discovered and executed by pytest by default.
2019-02-03 10:10:16 -08:00
Jon Dufresne
7da17ad41e Improve pytest configuration to allow specific tests as CLI args
The previous test configuration made it difficult to run a single test
with the pytest CLI. There were two major issues:

- The Tests directory was not a package. It now includes a __init__.py
  file and imports from other tests modules are done with relative
  imports.

- setup.cfg always specified the Tests directory. So even if a specific
  test were specified as a CLI arg, this configuration would also always
  include all tests. This configuration has been removed to allow
  specifying a single test on the command line.

Contributors can now run specific tests with a single command such as:

  $ tox -e py37 -- Tests/test_file_pdf.py::TestFilePdf.test_rgb

This makes it easy and faster to iterate on a single test failure and is
very familiar to those that have previously used tox and pytest.

When running tox or pytest with no arguments, they still discover and
runs all tests in the Tests directory.
2019-01-13 09:00:12 -08:00
hugovk
9dbaf92f3e itxt_chunks.png fails with protocol v2 2019-01-03 09:31:55 +11:00
hugovk
1b338998dc Test a png file with iTXt chunks 2019-01-03 09:31:55 +11:00
Andrew Murray
2202196162 Flake8 blank line fixes 2018-03-04 21:36:33 +11:00
homm
1ba4e9e5ba remove end of file banner from all files 2016-07-10 14:11:28 +03:00
Andrew Murray
1c99b39239 Fixed redefined built-in 2015-12-10 21:34:02 +11:00
Andrew Murray
ee34d6843b Further health fixes 2015-04-24 18:24:52 +10:00
hugovk
7823197fdd Failing tests to pickle L mode images 2015-01-30 14:00:46 +02:00
hugovk
bdf845d6df Fix typo: fihopperme -> filename 2014-09-15 08:59:28 +03:00
hugovk
8dad2b0c63 Replace some lena() with hopper(), and temporarily disable fail-fast so we can see all failures 2014-09-05 13:03:56 +03:00
hugovk
cf04a9a0d2 Remove unused tearDownModule 2014-07-07 20:03:50 +03:00
hugovk
78003ca473 Update paths to Tests/images/ instead of Images/ 2014-06-23 09:19:29 +03:00
hugovk
3ec505958e Convert old tests to use unittest 2014-06-10 12:10:47 +03:00
hugovk
a7d21dec15 Remove temp test code 2014-04-26 20:41:01 +03:00
hugovk
7d1cdc54c4 Don't skip all the tests on Python 3 when there's no cPickle, just the irrelevant test 2014-04-26 20:20:42 +03:00
hugovk
8794c46318 For pickling, test with Image's __eq__. Everything else can use the old assert_image_equal. 2014-04-26 20:05:02 +03:00
hugovk
2a6f2c5442 Add __eq__ and __ne__ to Image to be able to test image equality when pickling. Pickle more data. 2014-04-26 19:43:53 +03:00
hugovk
e4185694a2 P3 will skip explicit cPickle tests 2014-04-22 09:30:15 +03:00
hugovk
adfbe8323a Tests and partial implementation of pickling (#629) 2014-04-22 08:54:16 +03:00