def test_ignores_folders_in_excluded_folders(self): file_path = Path(__file__) parent_path = file_path.parent search_root = parent_path.parent # File should be found without excluding the folder it is in result = ndds.find_file(file_path.name, search_root) self.assertEqual(file_path, result) # Excluding the containing folder should mean the file is not found with self.assertRaises(FileNotFoundError): ndds.find_file(file_path.name, search_root, excluded_folders=[parent_path.name])
def test_raises_exception_if_file_is_not_found(self): search_root = Path(__file__).parent with self.assertRaises(FileNotFoundError): ndds.find_file('not_a_real_file', search_root)
def test_searches_subfolders(self): file_path = Path(__file__) result = ndds.find_file(file_path.name, file_path.parents[2]) self.assertEqual(file_path, result)
def test_returns_directory(self): directory_path = Path(__file__).parent result = ndds.find_file(directory_path.name, directory_path.parent) self.assertEqual(directory_path, result)
def test_returns_file(self): file_path = Path(__file__) result = ndds.find_file(file_path.name, file_path.parent) self.assertEqual(file_path, result)