diff options
author | Thomas Feldmann <mail@tfeldmann.de> | 2019-10-25 14:06:27 +0200 |
---|---|---|
committer | Thomas Feldmann <mail@tfeldmann.de> | 2019-10-25 14:06:27 +0200 |
commit | 54966de241cf4228fc0b97e96de443c70d2648c5 (patch) | |
tree | 9386eeeded8b7daba4f596bb615beb87f4abb902 /tests | |
parent | e197abca852fc7a7491ffa32c4ed70acb1013488 (diff) |
replace all assert_called with call_count > 0
to support python3.5
Diffstat (limited to 'tests')
-rw-r--r-- | tests/actions/test_move.py | 4 | ||||
-rw-r--r-- | tests/actions/test_rename.py | 16 |
2 files changed, 10 insertions, 10 deletions
diff --git a/tests/actions/test_move.py b/tests/actions/test_move.py index a68fe27..fee0294 100644 --- a/tests/actions/test_move.py +++ b/tests/actions/test_move.py @@ -163,8 +163,8 @@ def test_dont_keep_case_sensitive( mock_samefile.return_value = True move = Move(dest="~/TEST.PY") updates = move.run(**ARGS) - mock_mkdir.assert_called() + assert mock_mkdir.call_count > 0 mock_exists.assert_called_with() mock_trash.assert_not_called() - mock_move.assert_called() + assert mock_move.call_count > 0 assert updates is not None diff --git a/tests/actions/test_rename.py b/tests/actions/test_rename.py index 4cefb1c..912f41d 100644 --- a/tests/actions/test_rename.py +++ b/tests/actions/test_rename.py @@ -13,7 +13,7 @@ def test_tilde_expansion(mock_exists, mock_samefile, mock_rename, mock_trash): mock_samefile.return_value = False rename = Rename(name="newname.py", overwrite=False) new_path = rename.run(**ARGS) - mock_exists.assert_called() + assert mock_exists.call_count > 0 mock_trash.assert_not_called() expected_path = (Path.home() / "newname.py").expanduser() mock_rename.assert_called_with(expected_path) @@ -25,7 +25,7 @@ def test_overwrite(mock_exists, mock_samefile, mock_rename, mock_trash): mock_samefile.return_value = False rename = Rename(name="{path.stem} Kopie.py", overwrite=True) new_path = rename.run(**ARGS) - mock_exists.assert_called() + assert mock_exists.call_count > 0 mock_trash.assert_called_with(os.path.join(USER_DIR, "test Kopie.py")) mock_rename.assert_called_with(Path("~/test Kopie.py").expanduser()) assert new_path is not None @@ -36,7 +36,7 @@ def test_already_exists(mock_exists, mock_samefile, mock_rename, mock_trash): mock_samefile.return_value = False rename = Rename(name="asd.txt", overwrite=False) new_path = rename.run(**ARGS) - mock_exists.assert_called() + assert mock_exists.call_count > 0 mock_trash.assert_not_called() mock_rename.assert_called_with(Path("~/asd 2.txt").expanduser()) assert new_path is not None @@ -48,7 +48,7 @@ def test_overwrite_samefile(mock_exists, mock_samefile, mock_rename, mock_trash) mock_samefile.return_value = True rename = Rename(name="{path.stem}.pdf", overwrite=False) new_path = rename.run(**args) - mock_exists.assert_called() + assert mock_exists.call_count > 0 mock_trash.assert_not_called() mock_rename.assert_called_with((Path.home() / "test.pdf").expanduser()) assert new_path is not None @@ -60,7 +60,7 @@ def test_keep_name(mock_exists, mock_samefile, mock_rename, mock_trash): mock_samefile.return_value = True rename = Rename(name="{path.stem}.pdf", overwrite=False) new_path = rename.run(**args) - mock_exists.assert_called() + assert mock_exists.call_count > 0 mock_trash.assert_not_called() mock_rename.assert_not_called() assert new_path is not None @@ -71,7 +71,7 @@ def test_already_exists_multiple(mock_exists, mock_samefile, mock_rename, mock_t mock_samefile.return_value = False rename = Rename(name="asd.txt", overwrite=False) new_path = rename.run(**ARGS) - mock_exists.assert_called() + assert mock_exists.call_count > 0 mock_trash.assert_not_called() mock_rename.assert_called_with(Path("~/asd 4.txt").expanduser()) assert new_path is not None @@ -84,7 +84,7 @@ def test_already_exists_multiple_separator( mock_samefile.return_value = False rename = Rename(name="asd.txt", overwrite=False, counter_separator="-") new_path = rename.run(**ARGS) - mock_exists.assert_called() + assert mock_exists.call_count > 0 mock_trash.assert_not_called() mock_rename.assert_called_with(Path("~/asd-4.txt").expanduser()) assert new_path is not None @@ -102,7 +102,7 @@ def test_args(mock_exists, mock_samefile, mock_rename, mock_trash): mock_samefile.return_value = False rename = Rename(name="{nr.upper}-{path.stem} Kopie.py") new_path = rename.run(**args) - mock_exists.assert_called() + assert mock_exists.call_count > 0 mock_trash.assert_not_called() mock_rename.assert_called_with(Path("~/1-test Kopie.py").expanduser()) assert new_path is not None |