summaryrefslogtreecommitdiff
path: root/tests/unit/utils.py
diff options
context:
space:
mode:
authorTimothy Crosley <timothy.crosley@gmail.com>2020-08-28 02:10:40 -0700
committerTimothy Crosley <timothy.crosley@gmail.com>2020-08-28 02:10:40 -0700
commitdb3b8e6b8b5298ea614d6a5c75905c2c50ee7ca3 (patch)
treefb7efb174634c0aa077578d53e412706d98b6a20 /tests/unit/utils.py
parent968aed0bd91f8de507ffe3d4ed291cdaf73d0225 (diff)
downloadisort-db3b8e6b8b5298ea614d6a5c75905c2c50ee7ca3.tar.gz
Add additional profile tests
Diffstat (limited to 'tests/unit/utils.py')
-rw-r--r--tests/unit/utils.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/unit/utils.py b/tests/unit/utils.py
new file mode 100644
index 00000000..9c963d63
--- /dev/null
+++ b/tests/unit/utils.py
@@ -0,0 +1,14 @@
+import isort
+
+
+def isort_test(code: str, expected_output: str = "", **config):
+ """Runs isort against the given code snippet and ensures that it
+ gives consistent output accross multiple runs, and if an expected_output
+ is given - that it matches that.
+ """
+ expected_output = expected_output or code
+
+ output = isort.code(code, **config)
+ assert output == expected_output
+
+ assert output == isort.code(output, **config)