コード例 #1
0
def test_file_exists_returns_false_if_no_file(
    tmp_path: Path, sync_filesystem: SyncFilesystem
) -> None:
    """It should return False with file_exists if no JSON files exist."""
    path = PurePosixPath(tmp_path / "foo")
    exists = sync_filesystem.file_exists(path)

    assert exists is False
コード例 #2
0
def test_file_exists_returns_true_if_file_exists(
    tmp_path: Path, sync_filesystem: SyncFilesystem
) -> None:
    """It should return True with file_exists if JSON file exists."""
    (tmp_path / "foo.json").touch()
    path = PurePosixPath(tmp_path / "foo")
    exists = sync_filesystem.file_exists(path)

    assert exists is True
コード例 #3
0
def test_file_exists_returns_false_if_path_is_directory(
    tmp_path: Path, sync_filesystem: SyncFilesystem
) -> None:
    """It should return False with file_exists if path points to directory."""
    (tmp_path / "foo.json").mkdir()
    path = PurePosixPath(tmp_path / "foo")
    exists = sync_filesystem.file_exists(path)

    assert exists is False