Commit Graph

57 Commits

Author SHA1 Message Date
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
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
d69ef6a529 Remove redundant parentheses 2018-10-24 22:29:56 +03:00
Hugo
bab194b6f5 Fix DeprecationWarning: invalid escape sequence 2018-10-24 22:29:01 +03:00
Jon Dufresne
37f10651bd Clean up commented out debug print statements 2018-09-04 20:02:42 -07:00
Andrew Murray
c2189235af Line too long 2018-07-02 19:26:02 +10:00
Andrew Murray
c19d77abed Continuation line under-indented for visual indent 2018-07-02 19:21:44 +10:00
Hugo
ecc4c7fecc Remove unittest regex deprecation warnings 2018-04-14 21:54:40 +03:00
Andrew Murray
cca94054aa Changed assert statements to unittest calls 2018-01-17 22:01:37 +11:00
Alexander
af3dcf84af python api for resources 2017-09-18 01:41:39 +03:00
Alexander
a7cf91499a Regular comments instead of strings [ci skip] 2017-09-01 08:42:57 +03:00
Alexander
edcbd3f67d Tests for skipping passes (are passed if disable the passes skipping) 2017-08-31 23:01:21 +03:00
Alexander
79eae6e3bf actually box can be empty, this is noop 2017-08-11 19:36:46 +03:00
Alexander Karpinsky
09a2e1641b Merge branch 'master' into resample-roi 2017-08-11 19:10:11 +03:00
wiredfool
d8f15a0706 Merge pull request #2558 from uploadcare/resize-truncate-coeffs-2
Use round instead of floor to exclude of zero coefficients
2017-06-13 21:03:27 +01:00
Andrew Murray
b8e0daaf70 Replaced true assert with comment 2017-06-03 14:05:24 +10:00
Alexander
ad883961ac fix hamming filter 2017-05-29 14:29:12 +03:00
Andrew Murray
37b293f593 Flake8 fixes 2017-04-20 21:14:23 +10:00
homm
77210e410d test for common modes and filters
pass box for RGBA → RGBa conversion
2016-12-02 16:33:48 +03:00
homm
cf25722a73 improve error message 2016-12-02 15:42:33 +03:00
homm
295382aadc vertical and horizontal pass with boxes 2016-12-02 15:40:32 +03:00
homm
1477fbc07a update tests, add comments 2016-12-02 02:59:40 +03:00
homm
6def4bfc73 roi → box 2016-11-30 20:01:28 +03:00
Andrew Murray
67be3a9eda Added future print_function imports 2016-11-26 11:05:56 +11:00
Andrew Murray
4ed31e8ef7 Updated comments to use print as a function 2016-11-26 11:02:44 +11:00
homm
44e443fa75 fix int boundaries 2016-11-26 01:38:55 +03:00
homm
ef787bc3f5 use ROI in precompute_coeffs 2016-11-24 06:11:36 +03:00
homm
a1fedc0f8a expose roi to precompute_coeffs (still noop) 2016-11-24 06:05:20 +03:00
homm
338610b112 nearest and copy ROI 2016-11-24 05:12:41 +03:00
homm
f828416752 add roi argument to Image.resize() method
constraints check
2016-11-24 04:40:54 +03:00
homm
d4784bffb2 return copy of the image if size matches 2016-11-24 03:30:36 +03:00
homm
9947794ccd fix spelling error 2016-11-24 03:09:34 +03:00
Jon Dufresne
dbe9f85c7d Drop support for Python 2.6
* Drop unittest2 requirement
* Use set literals
* Use dict/set comprehension
* Use str.format() automatic numbering
2016-11-22 04:23:55 -08:00
Jon Dufresne
f041188050 Replace try/except/fail pattern with TestCase.assertRaises()
Replace pattern with the builtin support for asserting exceptions.
2016-11-06 13:43:09 -08:00
Alexander Karpinsky
5a359fbf28 Fix coefficients calculation (#2162)
Fix coefficients calculation

* test for regression

* detailed comments what is going on
prevent setting the `k[-1]` item

* more readable
2016-10-17 01:31:45 -07:00
Andrew Murray
72d5218080 Flake8 fixes 2016-09-03 12:17:22 +10:00
homm
5c0eb2c365 normalize coefficients in normalize_coeffs_8bpc
increase precision of negative filter lobes. Add test
2016-08-25 04:11:02 -07:00
homm
66715246c1 remove mitchell filter. Has no advantages over bicubic 2016-07-02 01:54:39 +03:00
homm
a67e5453d5 add tests, fix errors ) 2016-07-02 01:54:39 +03:00
homm
78fad0f819 Do not make unnecessary passes on resizing 2016-06-15 01:04:02 +03:00
homm
f09067e45e add La mode (2 bands) to the test 2016-05-28 10:47:14 +03:00
homm
a1b12f792a improve CoreResampleAccuracy test. Use all bands configurations 2016-05-27 07:09:49 +03:00
homm
c4b92d09b7 support for La mode 2016-05-26 15:15:08 +03:00
homm
1ed5c59f23 tests for LA modes 2016-05-26 15:15:08 +03:00
homm
8947485e71 test dirty pixels 2016-05-26 15:15:08 +03:00
homm
05d1022e99 test for levels 2016-05-26 15:15:08 +03:00
homm
5ffd9e53bc use calloc and INT_MAX 2016-05-26 02:28:35 +03:00
homm
555d2ace49 add test for L 2016-05-26 02:07:56 +03:00