2eaaa7f8ace52c29c83e36568417c92b358d9710
Marco Ricci Change the author e-mail ad...

Marco Ricci authored 2 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 4 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 1 month 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 3 months ago

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

Marco Ricci authored 1 month ago

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

Marco Ricci authored 3 months ago

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

Marco Ricci authored 4 months ago

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

Marco Ricci authored 1 month ago

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

Marco Ricci authored 3 months ago

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

Marco Ricci authored 3 months ago

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

Marco Ricci authored 4 months ago

tests/test_typing.py                   17) 
Marco Ricci Centralize settings for hyp...

Marco Ricci authored 1 month ago

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

Marco Ricci authored 1 month 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 3 months ago

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

Marco Ricci authored 1 month ago

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

Marco Ricci authored 3 months ago

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

Marco Ricci authored 1 month 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 3 months ago

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

Marco Ricci authored 1 month ago

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

Marco Ricci authored 3 months ago

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

Marco Ricci authored 1 month 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 3 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 4 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 1 month ago

tests/test_derivepassphrase_types.py   89) 
tests/test_derivepassphrase_types.py   90) 
Marco Ricci Manage health checks in cen...

Marco Ricci authored 1 month ago

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

Marco Ricci authored 1 month ago

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

Marco Ricci authored 1 month ago

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

Marco Ricci authored 1 month ago

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

Marco Ricci authored 1 month ago

tests/test_derivepassphrase_types.py  101) ) -> None:
Marco Ricci Signal and list falsy value...

Marco Ricci authored 1 month ago

tests/test_derivepassphrase_types.py  102)     _obj, comment, _ = test_config
tests/test_derivepassphrase_types.py  103)     obj = copy.deepcopy(_obj)
tests/test_derivepassphrase_types.py  104)     did_cleanup = _types.clean_up_falsy_vault_config_values(obj)
Marco Ricci Align behavior with vault c...

Marco Ricci authored 1 month ago

tests/test_derivepassphrase_types.py  105)     assert _types.is_vault_config(obj) == (not comment), (
tests/test_derivepassphrase_types.py  106)         'failed to complain about: ' + comment
tests/test_derivepassphrase_types.py  107)         if comment
tests/test_derivepassphrase_types.py  108)         else 'failed on valid example'
tests/test_derivepassphrase_types.py  109)     )
Marco Ricci Signal and list falsy value...

Marco Ricci authored 1 month ago

tests/test_derivepassphrase_types.py  110)     assert did_cleanup is None or bool(did_cleanup) == (
tests/test_derivepassphrase_types.py  111)         obj != _obj
tests/test_derivepassphrase_types.py  112)     ), 'mismatched report on cleanup work'
Marco Ricci Align behavior with vault c...

Marco Ricci authored 1 month ago

tests/test_derivepassphrase_types.py  113) 
tests/test_derivepassphrase_types.py  114) 
tests/test_derivepassphrase_types.py  115) @pytest.mark.parametrize(
tests/test_derivepassphrase_types.py  116)     'test_config', tests.TEST_CONFIGS, ids=tests._test_config_ids
tests/test_derivepassphrase_types.py  117) )
tests/test_derivepassphrase_types.py  118) def test_400_validate_vault_config(test_config: tests.VaultTestConfig) -> None:
tests/test_derivepassphrase_types.py  119)     obj, comment, validation_settings = test_config
tests/test_derivepassphrase_types.py  120)     allow_unknown_settings, allow_derivepassphrase_extensions = (
tests/test_derivepassphrase_types.py  121)         validation_settings or (True, True)
tests/test_derivepassphrase_types.py  122)     )
tests/test_derivepassphrase_types.py  123)     obj = copy.deepcopy(obj)
tests/test_derivepassphrase_types.py  124)     _types.clean_up_falsy_vault_config_values(obj)
tests/test_derivepassphrase_types.py  125)     if comment:
tests/test_derivepassphrase_types.py  126)         with pytest.raises((TypeError, ValueError)):
tests/test_derivepassphrase_types.py  127)             _types.validate_vault_config(
tests/test_derivepassphrase_types.py  128)                 obj,
tests/test_derivepassphrase_types.py  129)                 allow_unknown_settings=allow_unknown_settings,
tests/test_derivepassphrase_types.py  130)                 allow_derivepassphrase_extensions=allow_derivepassphrase_extensions,
tests/test_derivepassphrase_types.py  131)             )
tests/test_derivepassphrase_types.py  132)     else:
tests/test_derivepassphrase_types.py  133)         try:
tests/test_derivepassphrase_types.py  134)             _types.validate_vault_config(
tests/test_derivepassphrase_types.py  135)                 obj,
tests/test_derivepassphrase_types.py  136)                 allow_unknown_settings=allow_unknown_settings,
tests/test_derivepassphrase_types.py  137)                 allow_derivepassphrase_extensions=allow_derivepassphrase_extensions,
tests/test_derivepassphrase_types.py  138)             )
tests/test_derivepassphrase_types.py  139)         except (TypeError, ValueError) as exc:  # pragma: no cover
tests/test_derivepassphrase_types.py  140)             assert not exc, 'failed to validate valid example'  # noqa: PT017
tests/test_derivepassphrase_types.py  141) 
tests/test_derivepassphrase_types.py  142) 
Marco Ricci Manage health checks in cen...

Marco Ricci authored 1 month ago

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

Marco Ricci authored 1 month ago

tests/test_derivepassphrase_types.py  144) @hypothesis.given(
tests/test_derivepassphrase_types.py  145)     test_config=tests.smudged_vault_test_config(
tests/test_derivepassphrase_types.py  146)         config=strategies.sampled_from(tests.TEST_CONFIGS).filter(
tests/test_derivepassphrase_types.py  147)             tests.is_smudgable_vault_test_config
Marco Ricci Overhaul the validation fun...

Marco Ricci authored 1 month ago

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

Marco Ricci authored 1 month ago

tests/test_derivepassphrase_types.py  149)     )
tests/test_derivepassphrase_types.py  150) )
tests/test_derivepassphrase_types.py  151) def test_400a_validate_vault_config_smudged(
tests/test_derivepassphrase_types.py  152)     test_config: tests.VaultTestConfig,
tests/test_derivepassphrase_types.py  153) ) -> None:
Marco Ricci Signal and list falsy value...

Marco Ricci authored 1 month ago

tests/test_derivepassphrase_types.py  154)     _obj, comment, validation_settings = test_config
Marco Ricci Align behavior with vault c...

Marco Ricci authored 1 month ago

tests/test_derivepassphrase_types.py  155)     allow_unknown_settings, allow_derivepassphrase_extensions = (
tests/test_derivepassphrase_types.py  156)         validation_settings or (True, True)
tests/test_derivepassphrase_types.py  157)     )
Marco Ricci Signal and list falsy value...

Marco Ricci authored 1 month ago

tests/test_derivepassphrase_types.py  158)     obj = copy.deepcopy(_obj)
tests/test_derivepassphrase_types.py  159)     did_cleanup = _types.clean_up_falsy_vault_config_values(obj)
Marco Ricci Align behavior with vault c...

Marco Ricci authored 1 month ago

tests/test_derivepassphrase_types.py  160)     if comment:
tests/test_derivepassphrase_types.py  161)         with pytest.raises((TypeError, ValueError)):
tests/test_derivepassphrase_types.py  162)             _types.validate_vault_config(
tests/test_derivepassphrase_types.py  163)                 obj,
tests/test_derivepassphrase_types.py  164)                 allow_unknown_settings=allow_unknown_settings,
tests/test_derivepassphrase_types.py  165)                 allow_derivepassphrase_extensions=allow_derivepassphrase_extensions,
tests/test_derivepassphrase_types.py  166)             )
tests/test_derivepassphrase_types.py  167)     else:
tests/test_derivepassphrase_types.py  168)         try:
tests/test_derivepassphrase_types.py  169)             _types.validate_vault_config(
tests/test_derivepassphrase_types.py  170)                 obj,
tests/test_derivepassphrase_types.py  171)                 allow_unknown_settings=allow_unknown_settings,
tests/test_derivepassphrase_types.py  172)                 allow_derivepassphrase_extensions=allow_derivepassphrase_extensions,
tests/test_derivepassphrase_types.py  173)             )
tests/test_derivepassphrase_types.py  174)         except (TypeError, ValueError) as exc:  # pragma: no cover
tests/test_derivepassphrase_types.py  175)             assert not exc, 'failed to validate valid example'  # noqa: PT017