diff options
| author | Jonas Lundberg <jonas@5monkeys.se> | 2018-05-07 14:58:47 +0200 |
|---|---|---|
| committer | Jonas Lundberg <jonas@5monkeys.se> | 2018-05-07 14:58:47 +0200 |
| commit | 11831ad2b9076455c081c98efc9333ce22ca1c6d (patch) | |
| tree | 5cf174499e146276a50f80096f9deee155f1757f /test_isort.py | |
| parent | 145ee8127fa8c073ebef2855db192e1d2d62609b (diff) | |
| download | isort-11831ad2b9076455c081c98efc9333ce22ca1c6d.tar.gz | |
Add support for PY3-style packages
Diffstat (limited to 'test_isort.py')
| -rw-r--r-- | test_isort.py | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/test_isort.py b/test_isort.py index 3ddfcee9..0bffe9f1 100644 --- a/test_isort.py +++ b/test_isort.py @@ -33,6 +33,7 @@ import tempfile from isort.isort import SortImports, exists_case_sensitive from isort.main import is_python_file +from isort.pie_slice import PY2 from isort.settings import WrapModes SHORT_IMPORT = "from third_party import lib1, lib2, lib3, lib4" @@ -808,16 +809,31 @@ def test_thirdy_party_overrides_standard_section(): def test_known_pattern_path_expansion(): """Test to ensure patterns ending with path sep gets expanded and nested packages treated as known patterns""" - test_input = ("import sys\n" + test_input = ("from kate_plugin import isort_plugin\n" + "import sys\n" "import isort.settings\n" "import this\n" "import os\n") - test_output = SortImports(file_contents=test_input, known_first_party=['./', 'this']).output - assert test_output == ("import os\n" - "import sys\n" - "\n" - "import isort.settings\n" - "import this\n") + test_output = SortImports( + file_contents=test_input, + default_section='THIRDPARTY', + known_first_party=['./', 'this'] + ).output + if PY2: + assert test_output == ("import os\n" + "import sys\n" + "\n" + "from kate_plugin import isort_plugin\n" + "\n" + "import isort.settings\n" + "import this\n") + else: + assert test_output == ("import os\n" + "import sys\n" + "\n" + "import isort.settings\n" + "import this\n" + "from kate_plugin import isort_plugin\n") def test_force_single_line_imports(): |
