diff options
| author | staticdev <staticdev-support@protonmail.com> | 2022-12-12 12:57:41 +0100 |
|---|---|---|
| committer | staticdev <staticdev-support@protonmail.com> | 2022-12-12 12:57:41 +0100 |
| commit | 6090183e502c87fd6adb67d814207ca51ae8ef1a (patch) | |
| tree | ba9f7b7370504cc780a0ae8fa8adb8311cf83f6a /tests/unit | |
| parent | 3363240d53624c6d0f69f2703bc94fe77bcbd480 (diff) | |
| download | isort-6090183e502c87fd6adb67d814207ca51ae8ef1a.tar.gz | |
Move integration tests to its folder
Diffstat (limited to 'tests/unit')
| -rw-r--r-- | tests/unit/test_literal.py | 9 | ||||
| -rw-r--r-- | tests/unit/test_ticketed_features.py | 180 |
2 files changed, 1 insertions, 188 deletions
diff --git a/tests/unit/test_literal.py b/tests/unit/test_literal.py index ee623927..b4e036ce 100644 --- a/tests/unit/test_literal.py +++ b/tests/unit/test_literal.py @@ -2,7 +2,6 @@ import pytest import isort.literal from isort import exceptions -from isort.settings import Config def test_value_mismatch(): @@ -20,14 +19,6 @@ def test_invalid_sort_type(): isort.literal.assignment("x = [1, 2, 3", "tuple-list-not-exist", "py") -def test_value_assignment_list(): - assert isort.literal.assignment("x = ['b', 'a']", "list", "py") == "x = ['a', 'b']" - assert ( - isort.literal.assignment("x = ['b', 'a']", "list", "py", Config(formatter="example")) - == 'x = ["a", "b"]' - ) - - def test_value_assignment_assignments(): assert isort.literal.assignment("b = 1\na = 2\n", "assignments", "py") == "a = 2\nb = 1\n" diff --git a/tests/unit/test_ticketed_features.py b/tests/unit/test_ticketed_features.py index ca39c0f9..0460ae05 100644 --- a/tests/unit/test_ticketed_features.py +++ b/tests/unit/test_ticketed_features.py @@ -7,7 +7,7 @@ from io import StringIO import pytest import isort -from isort import Config, api, exceptions +from isort import Config, exceptions def test_semicolon_ignored_for_dynamic_lines_after_import_issue_1178(): @@ -237,15 +237,6 @@ def test_isort_supports_shared_profiles_issue_970(): assert isort.code("import a", profile="madeupfake") == "import a\n" # non-existent profile -def test_isort_supports_formatting_plugins_issue_1353(): - """Test to ensure isort provides a way to create and share formatting plugins. - See: https://github.com/pycqa/isort/issues/1353. - """ - assert isort.code("import a", formatter="example") == "import a\n" # formatting plugin - with pytest.raises(exceptions.FormattingPluginDoesNotExist): - assert isort.code("import a", formatter="madeupfake") == "import a\n" # non-existent plugin - - def test_treating_comments_as_code_issue_1357(): """Test to ensure isort provides a way to treat comments as code. See: https://github.com/pycqa/isort/issues/1357 @@ -366,175 +357,6 @@ import c ) -def test_isort_literals_issue_1358(): - assert ( - isort.code( - """ -import x -import a - - -# isort: list -__all__ = ["b", "a", "b"] - -# isort: unique-list -__all__ = ["b", "a", "b"] - -# isort: tuple -__all__ = ("b", "a", "b") - -# isort: unique-tuple -__all__ = ("b", "a", "b") - -# isort: set -__all__ = {"b", "a", "b"} - - -def method(): - # isort: list - x = ["b", "a"] - - -# isort: dict -y = {"z": "z", "b": "b", "b": "c"}""" - ) - == """ -import a -import x - -# isort: list -__all__ = ['a', 'b', 'b'] - -# isort: unique-list -__all__ = ['a', 'b'] - -# isort: tuple -__all__ = ('a', 'b', 'b') - -# isort: unique-tuple -__all__ = ('a', 'b') - -# isort: set -__all__ = {'a', 'b'} - - -def method(): - # isort: list - x = ['a', 'b'] - - -# isort: dict -y = {'b': 'c', 'z': 'z'}""" - ) - assert ( - isort.code( - """ -import x -import a - - -# isort: list -__all__ = ["b", "a", "b"] - -# isort: unique-list -__all__ = ["b", "a", "b"] - -# isort: tuple -__all__ = ("b", "a", "b") - -# isort: unique-tuple -__all__ = ("b", "a", "b") - -# isort: set -__all__ = {"b", "a", "b"} - - -def method(): - # isort: list - x = ["b", "a"] - - -# isort: assignments -d = 1 -b = 2 -a = 3 - -# isort: dict -y = {"z": "z", "b": "b", "b": "c"}""", - formatter="example", - ) - == """ -import a -import x - -# isort: list -__all__ = ["a", "b", "b"] - -# isort: unique-list -__all__ = ["a", "b"] - -# isort: tuple -__all__ = ("a", "b", "b") - -# isort: unique-tuple -__all__ = ("a", "b") - -# isort: set -__all__ = {"a", "b"} - - -def method(): - # isort: list - x = ["a", "b"] - - -# isort: assignments -a = 3 -b = 2 -d = 1 - -# isort: dict -y = {"b": "c", "z": "z"}""" - ) - assert api.sort_stream( - input_stream=StringIO( - """ -import a -import x - -# isort: list -__all__ = ["b", "a", "b"] - -# isort: unique-list -__all__ = ["b", "a", "b"] - -# isort: tuple -__all__ = ("b", "a", "b") - -# isort: unique-tuple -__all__ = ("b", "a", "b") - -# isort: set -__all__ = {"b", "a", "b"} - - -def method(): - # isort: list - x = ["b", "a"] - - -# isort: assignments -d = 1 -b = 2 -a = 3 - -# isort: dict -y = {"z": "z", "b": "b", "b": "c"}""", - ), - output_stream=StringIO(), - ) - - def test_isort_allows_setting_import_types_issue_1181(): """Test to ensure isort provides a way to set the type of imports. See: https://github.com/pycqa/isort/issues/1181 |
