# SPDX-FileCopyrightText: 2025 Marco Ricci <software@the13thletter.info>
#
# SPDX-License-Identifier: Zlib
from __future__ import annotations
import contextlib
import operator
import os
import pathlib
import string
import types
from typing import TYPE_CHECKING, Any, NamedTuple
import click.testing
import hypothesis
import pytest
from hypothesis import strategies
import tests
from derivepassphrase import cli, exporter
if TYPE_CHECKING:
from typing_extensions import Buffer
class Parametrize(types.SimpleNamespace):
EXPECTED_VAULT_PATH = pytest.mark.parametrize(
['expected', 'path'],
[
(pathlib.Path('/tmp'), pathlib.Path('/tmp')),
(pathlib.Path('~'), pathlib.Path()),
(pathlib.Path('~/.vault'), None),
],
)
EXPORT_VAULT_CONFIG_DATA_HANDLER_NAMELISTS = pytest.mark.parametrize(
['namelist', 'err_pat'],
[
pytest.param((), '[Nn]o names given', id='empty'),
pytest.param(
('name1', '', 'name2'),
'[Uu]nder an empty name',
id='empty-string',
),
pytest.param(
('dummy', 'name1', 'name2'),
'[Aa]lready registered',
id='existing',
),
],
)