Commit Graph

103 Commits

Author SHA1 Message Date
nulano
a0a5601689
Merge branch 'master' into gha-win 2019-10-08 12:56:43 +01:00
Jon Dufresne
64032061c0 Move several imports to the top-level of the file
This better follows PEP 8 style guide:

https://www.python.org/dev/peps/pep-0008/#imports

> Imports are always put at the top of the file, just after any module
> comments and docstrings, and before module globals and constants.

This also avoids duplicate import code within the same file.
2019-10-07 06:28:36 -07:00
Andrew Murray
ab52630d06 Catch buffer overruns 2019-09-30 18:45:43 +10:00
nulano
cf1f8b0498 Tests.helper cleanup 2019-09-25 11:58:02 +02: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
77f946d8bc Format with Black 2019-06-13 18:54:24 +03:00
Andrew Murray
691df96734 Fixed opening mmap image through Path on Windows 2019-05-04 15:00:49 +10:00
Hugo
a93bcdfe0c
Merge pull request #3724 from radarhere/readonly_save
Ensure image is mutable before saving
2019-03-28 11:53:33 +02:00
Hugo
adbe97594e
Merge pull request #3719 from radarhere/p_rgb_rgba
Allow RGB and RGBA values for new P images
2019-03-27 18:03:23 +02:00
Andrew Murray
0b62337b6f Ensure image is mutable before saving 2019-03-17 23:37:40 +11:00
Andrew Murray
6790c2e375 Allow RGB and RGBA values for new P images 2019-03-15 17:35:05 +11:00
Andrew Murray
22b0110f89 Only close original fp in __del__ and __exit__ if original fp is exclusive 2019-03-12 08:54:43 +11: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
Hugo
8a6f2b9de8 flake8: E711 comparison to None should be 'if cond is None:' 2018-11-11 19:01:10 +02:00
Hugo
d69ef6a529 Remove redundant parentheses 2018-10-24 22:29:56 +03:00
Hugo
a3b0659790 flake8 2018-10-24 22:29:01 +03:00
Hugo
d1ca4916e0 Use more specific assertions 2018-10-24 22:29:01 +03:00
Andrew Murray
0adeb82e98 Changed Image size property to be read-only by default 2018-09-30 13:45:18 +10:00
Andrew Murray
b4e6cdadac Added py3 variable to _util 2018-04-20 09:19:13 +10:00
Andrew Murray
b560f5b417 Changed Python version checks in tests to use helper 2018-04-19 19:40:56 +10:00
Kathryn Davies
8f6be2ee7d Move location of fclose and add dump test. 2018-03-31 21:28:37 -07:00
Hugo
8adab0ec0d Noise effect: take five pixels, assert not all same 2017-12-19 17:12:58 +02:00
Hugo
11a2026f12 flake8 2017-12-19 15:12:02 +02:00
Hugo
c8eebc1dc7 Re-roll in case of identical noise 2017-12-19 15:06:43 +02:00
Jon Dufresne
c5a0d72c10 Remove unnecessary bool() calls throughout project
Can use truthy values in boolean expressions without first coercing to a
bool. Removes unnecessary call to bool().
2017-12-16 09:34:12 -08:00
Andrew Murray
28119dd68d Changed test to use tempfile 2017-11-08 12:59:05 +11:00
wiredfool
c82f9fe1bb Merge pull request #2738 from uploadcare/block-storage
Block & array hybrid storage
2017-10-01 20:41:08 +01:00
hugovk
9344bd20dd Move test_no_resource_warning_for_numpy_array to test_numpy so it can be skipped easily 2017-09-23 22:39:10 +03:00
hugovk
0b6691ecc9 A numpy failing test for ResourceWarning on Python 3 2017-09-23 22:36:53 +03:00
hugovk
77f0608c4e Failing test for ResourceWarning on Python 3 2017-09-23 22:36:03 +03:00
wiredfool
b8d6fd57fa Merge pull request #1860 from radarhere/register_extensions
Added register_extensions method
2017-09-22 15:59:04 +01:00
Alexander
a78e92356f Merge branch 'master' into block-storage 2017-09-19 21:08:21 +03:00
wiredfool
c786213b09 Merge pull request #2291 from asergi/pathlib2
Use pathlib2 for Path objects on Python < 3.4
2017-09-19 11:11:35 +01:00
Alexander
0054743100 fix zero size images 2017-09-17 02:58:01 +03:00
Andrew Murray
55d0a816c7 Added test 2017-09-04 20:32:15 +10:00
wiredfool
2611b2caa5 Merge pull request #2689 from radarhere/tests
Added tests
2017-09-04 11:15:28 +01:00
Andrew Murray
2ac18689d5 Removed unnecessary return statements 2017-09-01 21:06:22 +10:00
Andrew Murray
9e843a2d9b Changed format of lambda calls 2017-09-01 21:05:40 +10:00
Andrew Murray
371933a597 Added tests 2017-09-01 20:36:51 +10:00
wiredfool
e422f92e52 Remove palettes from non-palette modes in _new #2702 2017-08-31 06:18:59 -07:00
wiredfool
e2602452f4 Merge pull request #2661 from uploadcare/get-channel
New Image.getchannel method
2017-08-16 15:33:54 +01:00
Alexander
e16ab0ad2e add tests, fix implementation 2017-08-12 14:10:39 +03:00
Alexander
0649da02c6 fix tests on python 3 2017-08-06 14:12:55 +03:00
Alexander
6b50ba07fd add tests for Image.new modes 2017-08-06 14:12:55 +03:00
wiredfool
c7efd0bf6d re-organized the parameters, moved size specification to overlay tuple 2017-06-27 22:03:44 +01:00
wiredfool
1d33dfbced Added source point parameter for Image.Image.alpha_composite 2017-06-27 22:03:44 +01:00
wiredfool
69768c514b Added inplace alpha composite 2017-06-27 22:03:44 +01:00
Andrew Murray
e8cba27bb1 Changed assert checks to more specific versions 2017-06-03 14:04:54 +10:00
Andrew Murray
2a5447691a Replaced deprecated assert_ 2017-05-30 19:55:35 +10:00