7d2f2b1bda31ead428d3c009772aaf3d2261d60c
Marco Ricci Change the author e-mail ad...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_types.py    1) # SPDX-FileCopyrightText: 2024 Marco Ricci <software@the13thletter.info>
Marco Ricci Move typing classes into se...

Marco Ricci authored 6 months ago

tests/test_typing.py                    2) #
tests/test_typing.py                    3) # SPDX-License-Identifier: MIT
tests/test_typing.py                    4) 
tests/test_typing.py                    5) from __future__ import annotations
tests/test_typing.py                    6) 
Marco Ricci Align behavior with vault c...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_types.py    7) import copy
tests/test_derivepassphrase_types.py    8) 
tests/test_derivepassphrase_types.py    9) import hypothesis
Marco Ricci Fix style issues with ruff...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase_typing.py  10) import pytest
Marco Ricci Align behavior with vault c...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_types.py   11) from hypothesis import strategies
Marco Ricci Support Python 3.10 and PyP...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase_typing.py  12) from typing_extensions import Any
Marco Ricci Move typing classes into se...

Marco Ricci authored 6 months ago

tests/test_typing.py                   13) 
Marco Ricci Align behavior with vault c...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_types.py   14) import tests
Marco Ricci Consolidate `types` submodu...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase_types.py   15) from derivepassphrase import _types
Marco Ricci Fix style issues with ruff...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase_typing.py  16) 
Marco Ricci Move typing classes into se...

Marco Ricci authored 6 months ago

tests/test_typing.py                   17) 
Marco Ricci Align behavior with vault c...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_types.py   18) @hypothesis.given(
tests/test_derivepassphrase_types.py   19)     value=strategies.one_of(
tests/test_derivepassphrase_types.py   20)         strategies.recursive(
tests/test_derivepassphrase_types.py   21)             strategies.one_of(
tests/test_derivepassphrase_types.py   22)                 strategies.none(),
tests/test_derivepassphrase_types.py   23)                 strategies.booleans(),
tests/test_derivepassphrase_types.py   24)                 strategies.integers(),
tests/test_derivepassphrase_types.py   25)                 strategies.floats(allow_nan=False, allow_infinity=False),
tests/test_derivepassphrase_types.py   26)                 strategies.text(max_size=100),
tests/test_derivepassphrase_types.py   27)                 strategies.binary(max_size=100),
tests/test_derivepassphrase_types.py   28)             ),
tests/test_derivepassphrase_types.py   29)             lambda s: strategies.one_of(
tests/test_derivepassphrase_types.py   30)                 strategies.frozensets(s, max_size=100),
tests/test_derivepassphrase_types.py   31)                 strategies.builds(
tests/test_derivepassphrase_types.py   32)                     tuple, strategies.frozensets(s, max_size=100)
tests/test_derivepassphrase_types.py   33)                 ),
tests/test_derivepassphrase_types.py   34)             ),
tests/test_derivepassphrase_types.py   35)             max_leaves=8,
tests/test_derivepassphrase_types.py   36)         ),
tests/test_derivepassphrase_types.py   37)         strategies.recursive(
tests/test_derivepassphrase_types.py   38)             strategies.one_of(
tests/test_derivepassphrase_types.py   39)                 strategies.none(),
tests/test_derivepassphrase_types.py   40)                 strategies.booleans(),
tests/test_derivepassphrase_types.py   41)                 strategies.integers(),
tests/test_derivepassphrase_types.py   42)                 strategies.floats(allow_nan=False, allow_infinity=False),
tests/test_derivepassphrase_types.py   43)                 strategies.text(max_size=100),
tests/test_derivepassphrase_types.py   44)                 strategies.binary(max_size=100),
tests/test_derivepassphrase_types.py   45)             ),
tests/test_derivepassphrase_types.py   46)             lambda s: strategies.one_of(
tests/test_derivepassphrase_types.py   47)                 strategies.lists(s, max_size=100),
tests/test_derivepassphrase_types.py   48)                 strategies.dictionaries(strategies.text(max_size=100), s),
tests/test_derivepassphrase_types.py   49)             ),
tests/test_derivepassphrase_types.py   50)             max_leaves=25,
tests/test_derivepassphrase_types.py   51)         ),
tests/test_derivepassphrase_types.py   52)         strategies.builds(tuple),
tests/test_derivepassphrase_types.py   53)         strategies.builds(list),
tests/test_derivepassphrase_types.py   54)         strategies.builds(dict),
tests/test_derivepassphrase_types.py   55)         strategies.builds(set),
tests/test_derivepassphrase_types.py   56)         strategies.builds(frozenset),
tests/test_derivepassphrase_types.py   57)     ),
tests/test_derivepassphrase_types.py   58) )
tests/test_derivepassphrase_types.py   59) def test_100_js_truthiness(value: Any) -> None:
tests/test_derivepassphrase_types.py   60)     expected = (
tests/test_derivepassphrase_types.py   61)         value is not None  # noqa: PLR1714
tests/test_derivepassphrase_types.py   62)         and value != False  # noqa: E712
tests/test_derivepassphrase_types.py   63)         and value != 0
tests/test_derivepassphrase_types.py   64)         and value != 0.0
tests/test_derivepassphrase_types.py   65)         and value != ''
tests/test_derivepassphrase_types.py   66)     )
tests/test_derivepassphrase_types.py   67)     assert _types.js_truthiness(value) == expected
tests/test_derivepassphrase_types.py   68) 
tests/test_derivepassphrase_types.py   69) 
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase_typing.py  70) @pytest.mark.parametrize(
Marco Ricci Align behavior with vault c...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_types.py   71)     'test_config',
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase_typing.py  72)     [
Marco Ricci Align behavior with vault c...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_types.py   73)         conf
tests/test_derivepassphrase_types.py   74)         for conf in tests.TEST_CONFIGS
tests/test_derivepassphrase_types.py   75)         if conf.validation_settings in {None, (True, True)}
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase_typing.py  76)     ],
Marco Ricci Align behavior with vault c...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_types.py   77)     ids=tests._test_config_ids,
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase_typing.py  78) )
Marco Ricci Align behavior with vault c...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_types.py   79) def test_200_is_vault_config(test_config: tests.VaultTestConfig) -> None:
tests/test_derivepassphrase_types.py   80)     obj, comment, _ = test_config
tests/test_derivepassphrase_types.py   81)     obj = copy.deepcopy(obj)
tests/test_derivepassphrase_types.py   82)     _types.clean_up_falsy_vault_config_values(obj)
tests/test_derivepassphrase_types.py   83)     assert _types.is_vault_config(obj) == (not comment), (
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase_typing.py  84)         'failed to complain about: ' + comment
tests/test_derivepassphrase_typing.py  85)         if comment
Marco Ricci Move typing classes into se...

Marco Ricci authored 6 months ago

tests/test_typing.py                   86)         else 'failed on valid example'
tests/test_typing.py                   87)     )
Marco Ricci Overhaul the validation fun...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_types.py   88) 
tests/test_derivepassphrase_types.py   89) 
Marco Ricci Align behavior with vault c...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_types.py   90) @hypothesis.given(
tests/test_derivepassphrase_types.py   91)     test_config=tests.smudged_vault_test_config(
tests/test_derivepassphrase_types.py   92)         config=strategies.sampled_from(tests.TEST_CONFIGS).filter(
tests/test_derivepassphrase_types.py   93)             tests.is_valid_test_config
tests/test_derivepassphrase_types.py   94)         )
tests/test_derivepassphrase_types.py   95)     )
Marco Ricci Overhaul the validation fun...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_types.py   96) )
Marco Ricci Align behavior with vault c...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_types.py   97) def test_200a_is_vault_config_smudged(
tests/test_derivepassphrase_types.py   98)     test_config: tests.VaultTestConfig,
Marco Ricci Overhaul the validation fun...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_types.py   99) ) -> None:
Marco Ricci Align behavior with vault c...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_types.py  100)     obj, comment, _ = test_config
tests/test_derivepassphrase_types.py  101)     obj = copy.deepcopy(obj)
tests/test_derivepassphrase_types.py  102)     _types.clean_up_falsy_vault_config_values(obj)
tests/test_derivepassphrase_types.py  103)     assert _types.is_vault_config(obj) == (not comment), (
tests/test_derivepassphrase_types.py  104)         'failed to complain about: ' + comment
tests/test_derivepassphrase_types.py  105)         if comment
tests/test_derivepassphrase_types.py  106)         else 'failed on valid example'
tests/test_derivepassphrase_types.py  107)     )
tests/test_derivepassphrase_types.py  108) 
tests/test_derivepassphrase_types.py  109) 
tests/test_derivepassphrase_types.py  110) @pytest.mark.parametrize(
tests/test_derivepassphrase_types.py  111)     'test_config', tests.TEST_CONFIGS, ids=tests._test_config_ids
tests/test_derivepassphrase_types.py  112) )
tests/test_derivepassphrase_types.py  113) def test_400_validate_vault_config(test_config: tests.VaultTestConfig) -> None:
tests/test_derivepassphrase_types.py  114)     obj, comment, validation_settings = test_config
tests/test_derivepassphrase_types.py  115)     allow_unknown_settings, allow_derivepassphrase_extensions = (
tests/test_derivepassphrase_types.py  116)         validation_settings or (True, True)
tests/test_derivepassphrase_types.py  117)     )
tests/test_derivepassphrase_types.py  118)     obj = copy.deepcopy(obj)
tests/test_derivepassphrase_types.py  119)     _types.clean_up_falsy_vault_config_values(obj)
tests/test_derivepassphrase_types.py  120)     if comment:
tests/test_derivepassphrase_types.py  121)         with pytest.raises((TypeError, ValueError)):
tests/test_derivepassphrase_types.py  122)             _types.validate_vault_config(
tests/test_derivepassphrase_types.py  123)                 obj,
tests/test_derivepassphrase_types.py  124)                 allow_unknown_settings=allow_unknown_settings,
tests/test_derivepassphrase_types.py  125)                 allow_derivepassphrase_extensions=allow_derivepassphrase_extensions,
tests/test_derivepassphrase_types.py  126)             )
tests/test_derivepassphrase_types.py  127)     else:
tests/test_derivepassphrase_types.py  128)         try:
tests/test_derivepassphrase_types.py  129)             _types.validate_vault_config(
tests/test_derivepassphrase_types.py  130)                 obj,
tests/test_derivepassphrase_types.py  131)                 allow_unknown_settings=allow_unknown_settings,
tests/test_derivepassphrase_types.py  132)                 allow_derivepassphrase_extensions=allow_derivepassphrase_extensions,
tests/test_derivepassphrase_types.py  133)             )
tests/test_derivepassphrase_types.py  134)         except (TypeError, ValueError) as exc:  # pragma: no cover
tests/test_derivepassphrase_types.py  135)             assert not exc, 'failed to validate valid example'  # noqa: PT017
tests/test_derivepassphrase_types.py  136) 
tests/test_derivepassphrase_types.py  137) 
tests/test_derivepassphrase_types.py  138) @hypothesis.given(
tests/test_derivepassphrase_types.py  139)     test_config=tests.smudged_vault_test_config(
tests/test_derivepassphrase_types.py  140)         config=strategies.sampled_from(tests.TEST_CONFIGS).filter(
tests/test_derivepassphrase_types.py  141)             tests.is_smudgable_vault_test_config
Marco Ricci Overhaul the validation fun...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_types.py  142)         )