3eabf0cd303c0e2e83a61a7c7835ee66b7fb5acf
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 4 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 Centralize settings for hyp...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_types.py   18) @tests.hypothesis_settings_coverage_compatible
Marco Ricci Align behavior with vault c...

Marco Ricci authored 2 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_types.py   74)         conf
tests/test_derivepassphrase_types.py   75)         for conf in tests.TEST_CONFIGS
tests/test_derivepassphrase_types.py   76)         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  77)     ],
Marco Ricci Align behavior with vault c...

Marco Ricci authored 2 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_types.py   80) def test_200_is_vault_config(test_config: tests.VaultTestConfig) -> None:
tests/test_derivepassphrase_types.py   81)     obj, comment, _ = test_config
tests/test_derivepassphrase_types.py   82)     obj = copy.deepcopy(obj)
tests/test_derivepassphrase_types.py   83)     _types.clean_up_falsy_vault_config_values(obj)
tests/test_derivepassphrase_types.py   84)     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  85)         'failed to complain about: ' + comment
tests/test_derivepassphrase_typing.py  86)         if comment
Marco Ricci Move typing classes into se...

Marco Ricci authored 6 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_types.py  143)         )