From b2e6d5c79d8d3098fc57a8647ddc6393a729f79a Mon Sep 17 00:00:00 2001 From: Chi-Sheng Liu Date: Wed, 25 Oct 2023 14:42:40 +0800 Subject: [PATCH] fixup! test(unittest): Rewrite unittests to meet new requirements --- tests/test_missing.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/test_missing.py b/tests/test_missing.py index d592990..94a74f3 100644 --- a/tests/test_missing.py +++ b/tests/test_missing.py @@ -163,7 +163,7 @@ def test__default(self, temp_git_folder): assert not (p / 'folder1' / 'empty_folder' / '__init__.py').exists() assert not (p / 'folder3' / '__init__.py').exists() assert not ( - p / 'folder1' / 'folder_containing_only_ignored_files' / '__init__.py' + p / 'folder1' / 'folder_containing_only_ignored_files' / '__init__.py' ).exists() assert (p / 'folder1' / '__init__.py').is_file() assert (p / 'folder1' / 'folder1_1' / 'folder1_1_1' / '__init__.py').is_file() @@ -187,12 +187,20 @@ def test__exclude(self, temp_git_folder): assert not (p / 'folder1' / 'empty_folder' / '__init__.py').exists() assert not (p / 'folder3' / '__init__.py').exists() assert not ( - p / 'folder1' / 'folder_containing_only_ignored_files' / '__init__.py' + p / 'folder1' / 'folder_containing_only_ignored_files' / '__init__.py' ).exists() assert not ( - p / 'folder1' / 'folder1_1' / 'folder1_1_1' / '__init__.py' + p / 'folder1' / 'folder1_1' / 'folder1_1_1' / '__init__.py' ).exists() assert (p / 'folder1' / '__init__.py').is_file() assert (p / 'folder1' / 'folder1_2' / '__init__.py').is_file() assert (p / 'folder2' / 'folder2_2' / '__init__.py').is_file() assert 0 == Missing(exclude=exclude).run() + + def test__non_str_sequence_exclude_throws_typeerror(self, temp_git_folder): + with pytest.raises(TypeError): + Missing(exclude=1) + + def test__non_dir_exclude_throws_typeerror(self, temp_git_folder): + with pytest.raises(TypeError): + Missing(exclude=['toplevel.py'])