コード例 #1
0
    def test__list_files__non_existing_directory__return_empty_list(self):
        # Act
        dw = DirWalker()
        result = dw.list_files(os.path.join(self.root_path, 'failure'))

        # Assert
        self.assertListEqual([], sorted(result))
コード例 #2
0
    def test__list_files_search__non_recursive__no_files_subdirectory(self):
        # Arrange
        dw = DirWalker(recursive=False)
        file_txt = File(self.txt_path)
        no_recursive_list = [file_txt, ]

        # Act
        result = dw.list_files(self.root_path)

        # Assert
        self.assertListEqual(sorted(no_recursive_list), sorted(result))
コード例 #3
0
    def test__list_files__search_filter_extensions__include_files(self):
        # Arrange
        dw = DirWalker(allowed_extensions=['txt', '.log'])
        file_txt = File(self.txt_path)
        file_log = File(self.log_path)
        recursive_list = [file_txt, file_log]

        # Act
        result = dw.list_files(self.root_path)

        # Assert
        self.assertListEqual(sorted(recursive_list), sorted(result))
コード例 #4
0
    def test__list_files__search_recursive__all_included(self):
        # Arrange
        dw = DirWalker()
        file_txt = File(self.txt_path)
        file_py = File(self.py_path)
        file_log = File(self.log_path)
        recursive_list = [file_txt, file_py, file_log]

        # Act
        result = dw.list_files(self.root_path)

        # Assert
        self.assertListEqual(sorted(recursive_list), sorted(result))