from testtools.matchers import FileExists def test_config_file_exists(): assert_that('/path/to/config/file', FileExists())
from testtools.matchers import FileExists import os def test_file_exists_in_directory(): file_name = 'test_file.txt' directory = '/path/to/directory' file_path = os.path.join(directory, file_name) with open(file_path, 'w') as test_file: test_file.write('Hello, World!') assert_that(file_path, FileExists())This test creates a file in the specified directory and checks if the file exists using the `FileExists` matcher. The package library containing the `testtools.matchers` module is the `testtools` library. This library provides a set of tools and utilities for testing, including assertion and matcher functions.