summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Fix bug regarding multiline docstringsJon Banafato2021-03-221-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a multiline docstring has its closing quotes at the end of a line instead of on a separate line, isort fails to properly add imports using the `add_imports` config option; instead, it adds the desired imports into the middle of the docstring as illustrated below. While PEP 257 (and other guides) advises that closing quotes appear on their own line, `isort` should not fail here. This change adds a check for closing docstrings at the end of a line in addition to the existing line start check for all comment indicators. A new section of the `test_add_imports` test explicitly tests multiline imports and this failure scenario specifically. --- A working example: ```python """My module. Provides example functionality. """ print("hello, world") ``` Running `isort --add-import "from __future__ import annotations"` produces the following as expected: ```python """My module. Provides example functionality. """ from __future__ import annotations print("hello, world") ``` --- The failure behavior described: ```python """My module. Provides example functionality.""" print("hello, world") ``` Running `isort --add-import "from __future__ import annotations"` as above produces the following result: ```python """My module. from __future__ import annotations Provides example functionality.""" print("hello, world") ``` Subsequent executions add more import lines into the docstring. This behavior occurs even if the file already has the desired imports.
* Fix test to ensure output is the sameTimothy Crosley2021-03-201-4/+4
|
* Create failing test for issue #1566Timothy Crosley2021-03-191-0/+12
|
* Fixed #1594: incorrect placement of noqa comments with multiple from imports.Timothy Crosley2021-03-181-0/+22
|
* Resolved #1504: Added ability to push star imports to the top to avoid ↵Timothy Crosley2021-03-171-0/+23
| | | | overriding explicitly defined imports.
* Add test case for issue #1645: Allowing sort order to be reversedTimothy Crosley2021-03-171-0/+30
|
* Add test case to ensure incorrectly formatted from statements dont disapearTimothy Crosley2021-03-151-0/+21
|
* Resolve #1684: Add support for --extend-skip and --extend-skip-globTimothy Crosley2021-03-131-1/+1
|
* Merge branch 'develop' into issue/1659/force-sort-sections-with-relative-importsTimothy Edmund Crosley2021-03-105-1/+122
|\
| * Implemented #1638 / #1644: Provide a flag to ensure same file handle is ↵Timothy Crosley2021-03-042-0/+6
| | | | | | | | used after sorting.
| * Fix indentationTimothy Crosley2021-03-031-1/+1
| |
| * Create failing test for issue #1667issue/1667Timothy Crosley2021-03-021-0/+17
| |
| * Add test for allowing root, switch to allow root commandTimothy Crosley2021-03-011-0/+5
| |
| * fix :Failed to pull configuration information from pyproject.tomldongfangtianyu2021-02-241-0/+25
| |
| * Add test case for issue #1670Timothy Crosley2021-02-171-0/+31
| |
| * Fix not replacing the source file if only literals are changed but not the ↵Marco Lam2021-02-171-1/+38
| | | | | | | | imports
* | squash! Add new option for sorting relative imports in force-sorted sectionsgofr2021-02-141-4/+4
| | | | | | | | Restore unrelated test to original
* | Add new option for sorting relative imports in force-sorted sectionsgofr2021-02-141-2/+37
| | | | | | | | | | | | | | | | Add --sort-relative-in-force-sorted-sections to make sorting of --force-sort-within-sections consistent with the way imports are sorted without force-sorted sections. Add tests for both the old and new behaviors.
* | Sort relative imports correctly with force_sort_within_sectionsgofr2021-02-112-4/+37
|/ | | | | | | | Relative import sort order when using force_sort_within_sections was inconsistent with the order without that setting. Change the force_sort_within_sections sort order to match. This fixes the relative import ordering issues noted in #1659.
* Make last snippet valid codeTimothy Crosley2021-02-091-1/+1
|
* Fix formattingTimothy Crosley2021-02-091-6/+13
|
* Add wemake profileTimothy Crosley2021-02-091-0/+80
|
* Made identified imports .statement() runnable codeissue/1641Timothy Crosley2021-02-071-4/+4
|
* Respect line_length in vertical grid modes and deprecate mode 6gofr2021-02-053-61/+17
| | | | | | | | | | | | | | | | | | | In the three vertical grid multi line modes (4, 5 and 6), each mode had a bug where the line length would be overcounted or undercounted by one character when used in combination with an unexpected value for the include_trailing_comma setting. This could cause import lines to exceed the line_length or be wrapped at one less than the specified line_length. Count the trailing characters correctly. This also deprecates mode 6, since the only difference between this mode and mode 5 is in how it handles include_trailing_comma. The distinction is no longer relevant, since mode 5 can now handle both possible values of include_trailing_comma. For backwards compatibility, make mode 6 an alias for mode 5.
* Unit test behavior of vertical grids close to the line lengthgofr2021-02-051-0/+46
| | | | | | | The three vertical grid multi line output modes 4, 5 and 6 use a shared function that makes them all wrap slightly differently when the import lines are right around the line length limit. Add tests to document the behavior and catch regressions.
* Fix broken integration testTimothy Crosley2021-02-031-1/+3
|
* Fix integration testTimothy Crosley2021-01-121-1/+13
|
* Add test for duplicate alias caseTimothy Crosley2021-01-121-0/+12
|
* Update test to use correct spacing for commentsTimothy Crosley2021-01-121-2/+2
|
* Add test case for issue #1631issue/1631Timothy Crosley2021-01-101-0/+10
|
* Merge pull request #1626 from gofr/issue/1624Timothy Edmund Crosley2021-01-011-0/+88
|\ | | | | Make force_sort_within_sections respect case
| * Move fix behind a flaggofr2020-12-311-1/+61
| |
| * Make force_sort_within_sections respect casegofr2020-12-301-1/+29
| | | | | | | | | | | | | | | | | | | | | | force_sort_within_sections only looked at the order_by_type option to determine how to order imports with different case in a section. Whether you order import names by type or not also affected the order of the modules. When force_sort_within_sections is used: * ignore case on the module name if case_sensitive is false, * ignore case on the imported names if order_by_type is false.
* | 100% test coverageTimothy Crosley2020-12-302-1/+28
| |
* | 100% test coverage for new identify moduleTimothy Crosley2020-12-301-1/+27
| |
* | Fix indented identification isortTimothy Crosley2020-12-303-7/+54
| |
* | Add additional identification test casesTimothy Crosley2020-12-301-2/+63
| |
* | Add initial unit testing for identify - with focuses on yield and raise edge ↵Timothy Crosley2020-12-301-0/+139
|/ | | | cases currently handled by import sorting core
* Update tests to enforce import identifaction line numbers use 1 base indexingTimothy Crosley2020-12-292-15/+15
|
* Add testing for uniqueTimothy Crosley2020-12-281-5/+16
|
* Fix test line lengthsTimothy Crosley2020-12-251-7/+13
|
* Remove uneeded lineTimothy Crosley2020-12-241-1/+0
|
* Expand test to capture case where comma is already presentTimothy Crosley2020-12-241-0/+9
|
* Add failing test for issue #1621: Showing that double comma does indeed apear.Timothy Crosley2020-12-241-0/+16
|
* identify imports directory supportTimothy Crosley2020-12-211-2/+1
|
* Add test for new files modulefeature/super-fast-import-identificationTimothy Crosley2020-12-201-0/+8
|
* All tests now passingdTimothy Crosley2020-12-203-48/+34
|
* lintingTimothy Crosley2020-12-131-1/+1
|
* Fix datadog integration testTimothy Crosley2020-12-121-1/+1
|
* Add test for #1604: allow toggling section header in indented importsTimothy Crosley2020-12-091-0/+48
|