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/integration | |
| parent | 3363240d53624c6d0f69f2703bc94fe77bcbd480 (diff) | |
| download | isort-6090183e502c87fd6adb67d814207ca51ae8ef1a.tar.gz | |
Move integration tests to its folder
Diffstat (limited to 'tests/integration')
| -rw-r--r-- | tests/integration/test_literal.py | 13 | ||||
| -rw-r--r-- | tests/integration/test_ticketed_features.py | 188 |
2 files changed, 201 insertions, 0 deletions
diff --git a/tests/integration/test_literal.py b/tests/integration/test_literal.py new file mode 100644 index 00000000..fe555e32 --- /dev/null +++ b/tests/integration/test_literal.py @@ -0,0 +1,13 @@ +"""Tests that need installation of other packages.""" +# TODO: find a way to install example-isort-formatting-plugin to pass tests +# import isort.literal + +# from isort.settings import Config + + +# 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"]' +# ) diff --git a/tests/integration/test_ticketed_features.py b/tests/integration/test_ticketed_features.py new file mode 100644 index 00000000..2a8eddbb --- /dev/null +++ b/tests/integration/test_ticketed_features.py @@ -0,0 +1,188 @@ +"""Tests that need installation of other packages.""" +# TODO: find a way to install example-isort-formatting-plugin to pass tests +# from io import StringIO + +# import pytest + +# import isort +# from isort import api, exceptions + + +# def test_isort_supports_formatting_plugins(): +# """Test to ensure isort provides a way to create and share formatting plugins. +# See: https://github.com/pycqa/isort/issues/1353. +# """ +# # formatting plugin +# assert isort.code("import a", formatter="example") == "import a\n" +# # non-existent plugin +# with pytest.raises(exceptions.FormattingPluginDoesNotExist): +# assert isort.code("import a", formatter="madeupfake") == "import a\n" + + +# 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(), +# ) |
