diff options
author | Thomas Feldmann <mail@tfeldmann.de> | 2022-02-09 12:33:21 +0100 |
---|---|---|
committer | Thomas Feldmann <mail@tfeldmann.de> | 2022-02-09 12:33:21 +0100 |
commit | 58bf92cfa1899e1c072ec63ada143b57dc073a78 (patch) | |
tree | 6394cf25407127305cc01e4daea3ff76fd617c6a /tests | |
parent | 24ce7508f40976c2a06a9288780a934e5063d357 (diff) |
format with black and isort
Diffstat (limited to 'tests')
28 files changed, 86 insertions, 32 deletions
diff --git a/tests/actions/test_copy.py b/tests/actions/test_copy.py index a892a43..ea87e90 100644 --- a/tests/actions/test_copy.py +++ b/tests/actions/test_copy.py @@ -1,6 +1,8 @@ from copy import deepcopy + import fs from conftest import make_files, read_files + from organize import core files = { diff --git a/tests/actions/test_echo.py b/tests/actions/test_echo.py index 0751f3a..c640480 100644 --- a/tests/actions/test_echo.py +++ b/tests/actions/test_echo.py @@ -1,7 +1,8 @@ from datetime import datetime -from organize.actions import Echo from unittest.mock import patch +from organize.actions import Echo + def test_echo_basic(): echo = Echo("Hello World") diff --git a/tests/actions/test_move.py b/tests/actions/test_move.py index 0abe50e..e28dfc9 100644 --- a/tests/actions/test_move.py +++ b/tests/actions/test_move.py @@ -1,5 +1,6 @@ import fs from conftest import make_files, read_files + from organize import core diff --git a/tests/actions/test_python.py b/tests/actions/test_python.py index 4892754..8ea2b9c 100644 --- a/tests/actions/test_python.py +++ b/tests/actions/test_python.py @@ -1,7 +1,7 @@ +from pathlib import Path from unittest.mock import patch from organize.actions import Python -from pathlib import Path def test_print_substitution(): diff --git a/tests/actions/test_shell.py b/tests/actions/test_shell.py index 4e9dadd..7807a23 100644 --- a/tests/actions/test_shell.py +++ b/tests/actions/test_shell.py @@ -1,7 +1,7 @@ +from pathlib import Path from unittest.mock import patch from organize.actions import Shell -from pathlib import Path def test_shell_basic(): diff --git a/tests/core/test_config.py b/tests/core/test_config.py index b67cc52..68e1d9a 100644 --- a/tests/core/test_config.py +++ b/tests/core/test_config.py @@ -1,8 +1,8 @@ -from fs import open_fs import pytest +from fs import open_fs +from schema import SchemaError from organize import config, core -from schema import SchemaError def validate_and_convert(string: str): diff --git a/tests/filters/test_extension.py b/tests/filters/test_extension.py index 1f468fb..4318f41 100644 --- a/tests/filters/test_extension.py +++ b/tests/filters/test_extension.py @@ -1,5 +1,6 @@ from fs import open_fs from fs.path import dirname + from organize.filters import Extension diff --git a/tests/filters/test_name.py b/tests/filters/test_name.py index 7c4c825..cea8384 100644 --- a/tests/filters/test_name.py +++ b/tests/filters/test_name.py @@ -1,4 +1,5 @@ import fs + from organize.filters import Name diff --git a/tests/filters/test_regex.py b/tests/filters/test_regex.py index bd98db2..af7a091 100644 --- a/tests/filters/test_regex.py +++ b/tests/filters/test_regex.py @@ -1,6 +1,6 @@ from pathlib import Path -from organize.filters import Regex +from organize.filters import Regex TESTDATA = [ ("RG123456123456-sig.pdf", True, "123456123456"), diff --git a/tests/integration/test_delete.py b/tests/integration/test_delete.py index c2d1570..7261e8e 100644 --- a/tests/integration/test_delete.py +++ b/tests/integration/test_delete.py @@ -1,5 +1,6 @@ import fs from conftest import make_files, read_files + from organize import core diff --git a/tests/integration/test_dict_merge.py b/tests/integration/test_dict_merge.py index dbe4f3e..521466c 100644 --- a/tests/integration/test_dict_merge.py +++ b/tests/integration/test_dict_merge.py @@ -2,6 +2,7 @@ from unittest.mock import call import fs from conftest import make_files, rules_shortcut + from organize import core diff --git a/tests/integration/test_duplicate.py b/tests/integration/test_duplicate.py index 174e59e..d728b32 100644 --- a/tests/integration/test_duplicate.py +++ b/tests/integration/test_duplicate.py @@ -1,5 +1,6 @@ import fs -from conftest import make_files, rules_shortcut, read_files +from conftest import make_files, read_files, rules_shortcut + from organize import core CONTENT_SMALL = "COPY CONTENT" diff --git a/tests/integration/test_rename.py b/tests/integration/test_rename.py index 5e8df5b..84fb0e4 100644 --- a/tests/integration/test_rename.py +++ b/tests/integration/test_rename.py @@ -1,5 +1,6 @@ import fs -from conftest import rules_shortcut, make_files, read_files +from conftest import make_files, read_files, rules_shortcut + from organize import core diff --git a/tests/todo/integration/test_exif.py b/tests/todo/integration/test_exif.py index a558622..c3826d5 100644 --- a/tests/todo/integration/test_exif.py +++ b/tests/todo/integration/test_exif.py @@ -1,7 +1,8 @@ import os import shutil -from conftest import TESTS_FOLDER, create_filesystem, assertdir +from conftest import TESTS_FOLDER, assertdir, create_filesystem + from organize.cli import main @@ -12,7 +13,7 @@ def copy_resources(tmp_path): def test_exif(tmp_path): - """ Sort photos by camera """ + """Sort photos by camera""" copy_resources(tmp_path) create_filesystem( tmp_path, @@ -41,7 +42,7 @@ def test_exif(tmp_path): def test_exif_filter_single(tmp_path): - """ Filter by camera """ + """Filter by camera""" copy_resources(tmp_path) create_filesystem( tmp_path, @@ -69,7 +70,7 @@ def test_exif_filter_single(tmp_path): def test_exif_filter_tag_exists(tmp_path): - """ Filter by GPS """ + """Filter by GPS""" copy_resources(tmp_path) create_filesystem( tmp_path, @@ -98,7 +99,7 @@ def test_exif_filter_tag_exists(tmp_path): def test_exif_filter_multiple(tmp_path): - """ Filter by camera """ + """Filter by camera""" copy_resources(tmp_path) create_filesystem( tmp_path, diff --git a/tests/todo/integration/test_extension.py b/tests/todo/integration/test_extension.py index 2862739..66c88ff 100644 --- a/tests/todo/integration/test_extension.py +++ b/tests/todo/integration/test_extension.py @@ -1,6 +1,7 @@ from unittest.mock import call from conftest import create_filesystem + from organize.cli import main diff --git a/tests/todo/integration/test_file_content.py b/tests/todo/integration/test_file_content.py index 273bb2e..b290b9a 100644 --- a/tests/todo/integration/test_file_content.py +++ b/tests/todo/integration/test_file_content.py @@ -1,6 +1,7 @@ import os -from conftest import create_filesystem, assertdir +from conftest import assertdir, create_filesystem + from organize.cli import main @@ -9,9 +10,12 @@ def test_file_content(tmp_path): create_filesystem( tmp_path, files=[ - ("Test1.txt", "Lorem MegaCorp Ltd. ipsum\nInvoice 12345\nMore text\nID: 98765"), + ( + "Test1.txt", + "Lorem MegaCorp Ltd. ipsum\nInvoice 12345\nMore text\nID: 98765", + ), ("Test2.txt", "Tests"), - ("Test3.txt", "My Homework ...") + ("Test3.txt", "My Homework ..."), ], config=r""" rules: diff --git a/tests/todo/integration/test_filesize.py b/tests/todo/integration/test_filesize.py index 2635e46..11aea4b 100644 --- a/tests/todo/integration/test_filesize.py +++ b/tests/todo/integration/test_filesize.py @@ -1,7 +1,8 @@ -import pytest from unittest.mock import call +import pytest from conftest import create_filesystem + from organize.cli import main @@ -49,7 +50,11 @@ def test_basic(tmp_path, mock_echo): ) main(["run", "--config-file=%s" % (tmp_path / "config.yaml")]) mock_echo.assert_has_calls( - [call("halffull 1010"), call("2/3 666"),], any_order=True, + [ + call("halffull 1010"), + call("2/3 666"), + ], + any_order=True, ) @@ -76,5 +81,8 @@ def test_python_args(tmp_path, mock_echo): ) main(["run", "--config-file=%s" % (tmp_path / "config.yaml")]) mock_echo.assert_has_calls( - [call("full 2000"),], any_order=True, + [ + call("full 2000"), + ], + any_order=True, ) diff --git a/tests/todo/integration/test_globstrings.py b/tests/todo/integration/test_globstrings.py index 2ff834f..d8d9a6c 100644 --- a/tests/todo/integration/test_globstrings.py +++ b/tests/todo/integration/test_globstrings.py @@ -1,4 +1,5 @@ -from conftest import create_filesystem, assertdir +from conftest import assertdir, create_filesystem + from organize.cli import main @@ -119,7 +120,11 @@ def test_globstr_exclude(tmp_path): ) main(["run", "--config-file=%s" % (tmp_path / "config.yaml")]) assertdir( - tmp_path, "Test.pdf", "Invoice.pdf", "Start.txt", "exclude/test.pdf", + tmp_path, + "Test.pdf", + "Invoice.pdf", + "Start.txt", + "exclude/test.pdf", ) diff --git a/tests/todo/integration/test_integration.py b/tests/todo/integration/test_integration.py index d899eac..a313fb7 100644 --- a/tests/todo/integration/test_integration.py +++ b/tests/todo/integration/test_integration.py @@ -1,5 +1,6 @@ import pytest from conftest import assertdir, create_filesystem + from organize.cli import main diff --git a/tests/todo/integration/test_python_filter.py b/tests/todo/integration/test_python_filter.py index 44f0ad8..97cf790 100644 --- a/tests/todo/integration/test_python_filter.py +++ b/tests/todo/integration/test_python_filter.py @@ -1,6 +1,7 @@ from unittest.mock import call from conftest import assertdir, create_filesystem + from organize.cli import main @@ -21,7 +22,12 @@ def test_python(tmp_path, mock_echo): ) main(["run", "--config-file=%s" % (tmp_path / "config.yaml")]) mock_echo.assert_has_calls( - (call("100"), call("200"), call("300"),), any_order=True, + ( + call("100"), + call("200"), + call("300"), + ), + any_order=True, ) @@ -69,7 +75,12 @@ def test_python_dict(tmp_path, mock_echo): ) main(["run", "--config-file=%s" % (tmp_path / "config.yaml")]) mock_echo.assert_has_calls( - (call("100 foo"), call("200 bar"), call("300 baz"),), any_order=True, + ( + call("100 foo"), + call("200 bar"), + call("300 baz"), + ), + any_order=True, ) diff --git a/tests/todo/integration/test_regex.py b/tests/todo/integration/test_regex.py index 9fe7a8e..f44eb4b 100644 --- a/tests/todo/integration/test_regex.py +++ b/tests/todo/integration/test_regex.py @@ -1,4 +1,5 @@ -from conftest import create_filesystem, assertdir +from conftest import assertdir, create_filesystem + from organize.cli import main diff --git a/tests/todo/integration/test_rename.py b/tests/todo/integration/test_rename.py index 977eebb..ccd0d1a 100644 --- a/tests/todo/integration/test_rename.py +++ b/tests/todo/integration/test_rename.py @@ -1,4 +1,5 @@ -from conftest import create_filesystem, assertdir +from conftest import assertdir, create_filesystem + from organize.cli import main @@ -6,7 +7,11 @@ def test_rename_issue51(tmp_path): # test for issue https://github.com/tfeldmann/organize/issues/51 create_filesystem( tmp_path, - files=["19asd_WF_test2.pdf", "other.pdf", "18asd_WFX_test2.pdf",], + files=[ + "19asd_WF_test2.pdf", + "other.pdf", + "18asd_WFX_test2.pdf", + ], config=r""" rules: - folders: files diff --git a/tests/todo/integration/test_startswith.py b/tests/todo/integration/test_startswith.py index 8510e70..ec8f452 100644 --- a/tests/todo/integration/test_startswith.py +++ b/tests/todo/integration/test_startswith.py @@ -1,4 +1,5 @@ -from conftest import create_filesystem, assertdir +from conftest import assertdir, create_filesystem + from organize.cli import main @@ -6,7 +7,11 @@ def test_startswith_issue74(tmp_path): # test for issue https://github.com/tfeldmann/organize/issues/74 create_filesystem( tmp_path, - files=["Cálculo_1.pdf", "Cálculo_2.pdf", "Calculo.pdf",], + files=[ + "Cálculo_1.pdf", + "Cálculo_2.pdf", + "Calculo.pdf", + ], config=r""" # Cálculo PDF rules: diff --git a/tests/todo/integration/test_unicode.py b/tests/todo/integration/test_unicode.py index d3d9500..29b5d57 100644 --- a/tests/todo/integration/test_unicode.py +++ b/tests/todo/integration/test_unicode.py @@ -1,5 +1,6 @@ import pytest from conftest import assertdir, create_filesystem + from organize.cli import main diff --git a/tests/todo/todo_copy.py b/tests/todo/todo_copy.py index d9596c5..8f794b8 100644 --- a/tests/todo/todo_copy.py +++ b/tests/todo/todo_copy.py @@ -1,7 +1,7 @@ import os +from pathlib import Path from organize.actions import Copy -from pathlib import Path USER_DIR = os.path.expanduser("~") diff --git a/tests/todo/todo_move.py b/tests/todo/todo_move.py index 764a396..cc4f25e 100644 --- a/tests/todo/todo_move.py +++ b/tests/todo/todo_move.py @@ -1,7 +1,7 @@ import os +from pathlib import Path from organize.actions import Move -from pathlib import Path from organize.utils import DotDict USER_DIR = os.path.expanduser("~") diff --git a/tests/todo/todo_rename.py b/tests/todo/todo_rename.py index 8ec4459..89fe7d2 100644 --- a/tests/todo/todo_rename.py +++ b/tests/todo/todo_rename.py @@ -1,7 +1,7 @@ import os +from pathlib import Path from organize.actions import Rename -from pathlib import Path USER_DIR = os.path.expanduser("~") @@ -17,7 +17,7 @@ def test_tilde_expansion(mock_exists, mock_samefile, mock_rename, mock_trash): mock_trash.assert_not_called() expected_path = (Path.home() / "newname.py").expanduser() mock_rename.assert_called_with(expected_path) - assert new_path == {'path': expected_path} + assert new_path == {"path": expected_path} def test_overwrite(mock_exists, mock_samefile, mock_rename, mock_trash): diff --git a/tests/utils/test_is_same_resource.py b/tests/utils/test_is_same_resource.py index 6334dbc..dfff1ab 100644 --- a/tests/utils/test_is_same_resource.py +++ b/tests/utils/test_is_same_resource.py @@ -1,5 +1,6 @@ from fs import open_fs from fs.memoryfs import MemoryFS + from organize.utils import is_same_resource |