b685fdd3a683a781d48c35832818f9c4e0f6790a
Marco Ricci Change the author e-mail ad...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_vault.py   1) # SPDX-FileCopyrightText: 2024 Marco Ricci <software@the13thletter.info>
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py         2) #
tests/test_derivepassphrase.py         3) # SPDX-License-Identifier: MIT
tests/test_derivepassphrase.py         4) 
Marco Ricci Move `sequin` and `ssh_agen...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase.py         5) """Test passphrase generation via derivepassphrase.vault.Vault."""
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py         6) 
tests/test_derivepassphrase.py         7) from __future__ import annotations
tests/test_derivepassphrase.py         8) 
tests/test_derivepassphrase.py         9) import math
Marco Ricci Add hypothesis-based tests...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_vault.py  10) from typing import TYPE_CHECKING, TypeAlias, TypeVar
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        11) 
Marco Ricci Add hypothesis-based tests...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_vault.py  12) import hypothesis
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        13) import pytest
Marco Ricci Add hypothesis-based tests...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_vault.py  14) from hypothesis import strategies
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        15) 
Marco Ricci Fix style issues with ruff...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        16) import derivepassphrase
tests/test_derivepassphrase.py        17) 
Marco Ricci Add hypothesis-based tests...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_vault.py  18) if TYPE_CHECKING:
tests/test_derivepassphrase_vault.py  19)     from collections.abc import Iterator
tests/test_derivepassphrase_vault.py  20) 
tests/test_derivepassphrase_vault.py  21) Vault: TypeAlias = derivepassphrase.vault.Vault
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        22) 
tests/test_derivepassphrase.py        23) 
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        24) class TestVault:
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        25)     phrase = b'She cells C shells bye the sea shoars'
tests/test_derivepassphrase.py        26)     google_phrase = rb': 4TVH#5:aZl8LueOT\{'
tests/test_derivepassphrase.py        27)     twitter_phrase = rb"[ (HN_N:lI&<ro=)3'g9"
tests/test_derivepassphrase.py        28) 
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        29)     @pytest.mark.parametrize(
tests/test_derivepassphrase.py        30)         ['service', 'expected'],
tests/test_derivepassphrase.py        31)         [
tests/test_derivepassphrase.py        32)             (b'google', google_phrase),
tests/test_derivepassphrase.py        33)             ('twitter', twitter_phrase),
tests/test_derivepassphrase.py        34)         ],
tests/test_derivepassphrase.py        35)     )
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase.py        36)     def test_200_basic_configuration(
tests/test_derivepassphrase.py        37)         self, service: bytes | str, expected: bytes
tests/test_derivepassphrase.py        38)     ) -> None:
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        39)         assert Vault(phrase=self.phrase).generate(service) == expected
tests/test_derivepassphrase.py        40) 
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase.py        41)     def test_201_phrase_dependence(self) -> None:
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        42)         assert (
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        43)             Vault(phrase=(self.phrase + b'X')).generate('google')
tests/test_derivepassphrase.py        44)             == b'n+oIz6sL>K*lTEWYRO%7'
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        45)         )
tests/test_derivepassphrase.py        46) 
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase.py        47)     def test_202_reproducibility_and_bytes_service_name(self) -> None:
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        48)         assert Vault(phrase=self.phrase).generate(b'google') == Vault(
tests/test_derivepassphrase.py        49)             phrase=self.phrase
tests/test_derivepassphrase.py        50)         ).generate('google')
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        51) 
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase.py        52)     def test_203_reproducibility_and_bytearray_service_name(self) -> None:
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        53)         assert Vault(phrase=self.phrase).generate(b'google') == Vault(
tests/test_derivepassphrase.py        54)             phrase=self.phrase
tests/test_derivepassphrase.py        55)         ).generate(bytearray(b'google'))
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        56) 
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase.py        57)     def test_210_nonstandard_length(self) -> None:
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        58)         assert (
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        59)             Vault(phrase=self.phrase, length=4).generate('google') == b'xDFu'
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        60)         )
tests/test_derivepassphrase.py        61) 
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase.py        62)     def test_211_repetition_limit(self) -> None:
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        63)         assert (
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        64)             Vault(
tests/test_derivepassphrase.py        65)                 phrase=b'', length=24, symbol=0, number=0, repeat=1
tests/test_derivepassphrase.py        66)             ).generate('asd')
tests/test_derivepassphrase.py        67)             == b'IVTDzACftqopUXqDHPkuCIhV'
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        68)         )
tests/test_derivepassphrase.py        69) 
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase.py        70)     def test_212_without_symbols(self) -> None:
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        71)         assert (
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        72)             Vault(phrase=self.phrase, symbol=0).generate('google')
tests/test_derivepassphrase.py        73)             == b'XZ4wRe0bZCazbljCaMqR'
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        74)         )
tests/test_derivepassphrase.py        75) 
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase.py        76)     def test_213_no_numbers(self) -> None:
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        77)         assert (
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        78)             Vault(phrase=self.phrase, number=0).generate('google')
tests/test_derivepassphrase.py        79)             == b'_*$TVH.%^aZl(LUeOT?>'
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        80)         )
tests/test_derivepassphrase.py        81) 
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase.py        82)     def test_214_no_lowercase_letters(self) -> None:
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        83)         assert (
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        84)             Vault(phrase=self.phrase, lower=0).generate('google')
tests/test_derivepassphrase.py        85)             == b':{?)+7~@OA:L]!0E$)(+'
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        86)         )
tests/test_derivepassphrase.py        87) 
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase.py        88)     def test_215_at_least_5_digits(self) -> None:
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        89)         assert (
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        90)             Vault(phrase=self.phrase, length=8, number=5).generate('songkick')
tests/test_derivepassphrase.py        91)             == b'i0908.7['
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        92)         )
tests/test_derivepassphrase.py        93) 
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase.py        94)     def test_216_lots_of_spaces(self) -> None:
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        95)         assert (
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        96)             Vault(phrase=self.phrase, space=12).generate('songkick')
tests/test_derivepassphrase.py        97)             == b' c   6 Bq  % 5fR    '
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py        98)         )
tests/test_derivepassphrase.py        99) 
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase.py       100)     def test_217_all_character_classes(self) -> None:
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       101)         assert (
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       102)             Vault(
tests/test_derivepassphrase.py       103)                 phrase=self.phrase,
tests/test_derivepassphrase.py       104)                 lower=2,
tests/test_derivepassphrase.py       105)                 upper=2,
tests/test_derivepassphrase.py       106)                 number=1,
tests/test_derivepassphrase.py       107)                 space=3,
tests/test_derivepassphrase.py       108)                 dash=2,
tests/test_derivepassphrase.py       109)                 symbol=1,
tests/test_derivepassphrase.py       110)             ).generate('google')
tests/test_derivepassphrase.py       111)             == b': : fv_wqt>a-4w1S  R'
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       112)         )
tests/test_derivepassphrase.py       113) 
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase.py       114)     def test_218_only_numbers_and_very_high_repetition_limit(self) -> None:
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       115)         generated = Vault(
tests/test_derivepassphrase.py       116)             phrase=b'',
tests/test_derivepassphrase.py       117)             length=40,
tests/test_derivepassphrase.py       118)             lower=0,
tests/test_derivepassphrase.py       119)             upper=0,
tests/test_derivepassphrase.py       120)             space=0,
tests/test_derivepassphrase.py       121)             dash=0,
tests/test_derivepassphrase.py       122)             symbol=0,
tests/test_derivepassphrase.py       123)             repeat=4,
tests/test_derivepassphrase.py       124)         ).generate('abcdef')
tests/test_derivepassphrase.py       125)         forbidden_substrings = {
tests/test_derivepassphrase.py       126)             b'0000',
tests/test_derivepassphrase.py       127)             b'1111',
tests/test_derivepassphrase.py       128)             b'2222',
tests/test_derivepassphrase.py       129)             b'3333',
tests/test_derivepassphrase.py       130)             b'4444',
tests/test_derivepassphrase.py       131)             b'5555',
tests/test_derivepassphrase.py       132)             b'6666',
tests/test_derivepassphrase.py       133)             b'7777',
tests/test_derivepassphrase.py       134)             b'8888',
tests/test_derivepassphrase.py       135)             b'9999',
tests/test_derivepassphrase.py       136)         }
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       137)         for substring in forbidden_substrings:
tests/test_derivepassphrase.py       138)             assert substring not in generated
tests/test_derivepassphrase.py       139) 
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase.py       140)     def test_219_very_limited_character_set(self) -> None:
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       141)         generated = Vault(
tests/test_derivepassphrase.py       142)             phrase=b'', length=24, lower=0, upper=0, space=0, symbol=0
tests/test_derivepassphrase.py       143)         ).generate('testing')
Marco Ricci Fix style issues with ruff...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       144)         assert generated == b'763252593304946694588866'
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       145) 
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase.py       146)     def test_220_character_set_subtraction(self) -> None:
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       147)         assert Vault._subtract(b'be', b'abcdef') == bytearray(b'acdf')
tests/test_derivepassphrase.py       148) 
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       149)     @pytest.mark.parametrize(
tests/test_derivepassphrase.py       150)         ['length', 'settings', 'entropy'],
tests/test_derivepassphrase.py       151)         [
tests/test_derivepassphrase.py       152)             (20, {}, math.log2(math.factorial(20)) + 20 * math.log2(94)),
tests/test_derivepassphrase.py       153)             (
tests/test_derivepassphrase.py       154)                 20,
tests/test_derivepassphrase.py       155)                 {'upper': 0, 'number': 0, 'space': 0, 'symbol': 0},
tests/test_derivepassphrase.py       156)                 math.log2(math.factorial(20)) + 20 * math.log2(26),
tests/test_derivepassphrase.py       157)             ),
tests/test_derivepassphrase.py       158)             (0, {}, float('-inf')),
tests/test_derivepassphrase.py       159)             (
tests/test_derivepassphrase.py       160)                 0,
tests/test_derivepassphrase.py       161)                 {'lower': 0, 'number': 0, 'space': 0, 'symbol': 0},
tests/test_derivepassphrase.py       162)                 float('-inf'),
tests/test_derivepassphrase.py       163)             ),
tests/test_derivepassphrase.py       164)             (1, {}, math.log2(94)),
tests/test_derivepassphrase.py       165)             (1, {'upper': 0, 'lower': 0, 'number': 0, 'symbol': 0}, 0.0),
tests/test_derivepassphrase.py       166)         ],
tests/test_derivepassphrase.py       167)     )
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       168)     def test_221_entropy(
tests/test_derivepassphrase.py       169)         self, length: int, settings: dict[str, int], entropy: int
tests/test_derivepassphrase.py       170)     ) -> None:
tests/test_derivepassphrase.py       171)         v = Vault(length=length, **settings)  # type: ignore[arg-type]
tests/test_derivepassphrase.py       172)         assert math.isclose(v._entropy(), entropy)
tests/test_derivepassphrase.py       173)         assert v._estimate_sufficient_hash_length() > 0
tests/test_derivepassphrase.py       174)         if math.isfinite(entropy) and entropy:
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       175)             assert v._estimate_sufficient_hash_length(1.0) == math.ceil(
tests/test_derivepassphrase.py       176)                 entropy / 8
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       177)             )
tests/test_derivepassphrase.py       178)         assert v._estimate_sufficient_hash_length(8.0) >= entropy
tests/test_derivepassphrase.py       179) 
tests/test_derivepassphrase.py       180)     def test_222_hash_length_estimation(self) -> None:
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       181)         v = Vault(
tests/test_derivepassphrase.py       182)             phrase=self.phrase,
tests/test_derivepassphrase.py       183)             lower=0,
tests/test_derivepassphrase.py       184)             upper=0,
tests/test_derivepassphrase.py       185)             number=0,
tests/test_derivepassphrase.py       186)             symbol=0,
tests/test_derivepassphrase.py       187)             space=1,
tests/test_derivepassphrase.py       188)             length=1,
tests/test_derivepassphrase.py       189)         )
Marco Ricci Fix style issues with ruff...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       190)         assert v._entropy() == 0.0
tests/test_derivepassphrase.py       191)         assert v._estimate_sufficient_hash_length() > 0
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       192) 
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       193)     @pytest.mark.parametrize(
tests/test_derivepassphrase.py       194)         ['service', 'expected'],
tests/test_derivepassphrase.py       195)         [
tests/test_derivepassphrase.py       196)             (b'google', google_phrase),
tests/test_derivepassphrase.py       197)             ('twitter', twitter_phrase),
tests/test_derivepassphrase.py       198)         ],
tests/test_derivepassphrase.py       199)     )
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       200)     def test_223_hash_length_expansion(
Marco Ricci Clean up testing machinery...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_vault.py 201)         self,
tests/test_derivepassphrase_vault.py 202)         monkeypatch: pytest.MonkeyPatch,
tests/test_derivepassphrase_vault.py 203)         service: str | bytes,
tests/test_derivepassphrase_vault.py 204)         expected: bytes,
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       205)     ) -> None:
tests/test_derivepassphrase.py       206)         v = Vault(phrase=self.phrase)
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       207)         monkeypatch.setattr(
tests/test_derivepassphrase.py       208)             v,
tests/test_derivepassphrase.py       209)             '_estimate_sufficient_hash_length',
tests/test_derivepassphrase.py       210)             lambda *args, **kwargs: 1,  # noqa: ARG005
tests/test_derivepassphrase.py       211)         )
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       212)         assert v._estimate_sufficient_hash_length() < len(self.phrase)
tests/test_derivepassphrase.py       213)         assert v.generate(service) == expected
tests/test_derivepassphrase.py       214) 
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       215)     @pytest.mark.parametrize(
Marco Ricci Allow all textual strings,...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase.py       216)         's',
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       217)         [
Marco Ricci Allow all textual strings,...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase.py       218)             'ñ',
tests/test_derivepassphrase.py       219)             'Düsseldorf',
tests/test_derivepassphrase.py       220)             'liberté, egalité, fraternité',
tests/test_derivepassphrase.py       221)             'ASCII',
tests/test_derivepassphrase.py       222)             b'D\xc3\xbcsseldorf',
tests/test_derivepassphrase.py       223)             bytearray([2, 3, 5, 7, 11, 13]),
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       224)         ],
tests/test_derivepassphrase.py       225)     )
Marco Ricci Allow all textual strings,...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase.py       226)     def test_224_binary_strings(self, s: str | bytes | bytearray) -> None:
Marco Ricci Move `sequin` and `ssh_agen...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase.py       227)         binstr = Vault._get_binary_string
Marco Ricci Allow all textual strings,...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase.py       228)         if isinstance(s, str):
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       229)             assert binstr(s) == s.encode('UTF-8')
tests/test_derivepassphrase.py       230)             assert binstr(binstr(s)) == s.encode('UTF-8')
tests/test_derivepassphrase.py       231)         else:
tests/test_derivepassphrase.py       232)             assert binstr(s) == bytes(s)
tests/test_derivepassphrase.py       233)             assert binstr(binstr(s)) == bytes(s)
tests/test_derivepassphrase.py       234) 
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase.py       235)     def test_310_too_many_symbols(self) -> None:
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       236)         with pytest.raises(
tests/test_derivepassphrase.py       237)             ValueError, match='requested passphrase length too short'
tests/test_derivepassphrase.py       238)         ):
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       239)             Vault(phrase=self.phrase, symbol=100)
tests/test_derivepassphrase.py       240) 
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase.py       241)     def test_311_no_viable_characters(self) -> None:
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       242)         with pytest.raises(ValueError, match='no allowed characters left'):
tests/test_derivepassphrase.py       243)             Vault(
tests/test_derivepassphrase.py       244)                 phrase=self.phrase,
tests/test_derivepassphrase.py       245)                 lower=0,
tests/test_derivepassphrase.py       246)                 upper=0,
tests/test_derivepassphrase.py       247)                 number=0,
tests/test_derivepassphrase.py       248)                 space=0,
tests/test_derivepassphrase.py       249)                 dash=0,
tests/test_derivepassphrase.py       250)                 symbol=0,
tests/test_derivepassphrase.py       251)             )
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       252) 
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase.py       253)     def test_320_character_set_subtraction_duplicate(self) -> None:
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       254)         with pytest.raises(ValueError, match='duplicate characters'):
tests/test_derivepassphrase.py       255)             Vault._subtract(b'abcdef', b'aabbccddeeff')
tests/test_derivepassphrase.py       256)         with pytest.raises(ValueError, match='duplicate characters'):
tests/test_derivepassphrase.py       257)             Vault._subtract(b'aabbccddeeff', b'abcdef')
tests/test_derivepassphrase.py       258) 
tests/test_derivepassphrase.py       259)     def test_322_hash_length_estimation(self) -> None:
tests/test_derivepassphrase.py       260)         v = Vault(phrase=self.phrase)
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       261)         with pytest.raises(ValueError, match='invalid safety factor'):
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       262)             assert v._estimate_sufficient_hash_length(-1.0)
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_derivepassphrase.py       263)         with pytest.raises(
tests/test_derivepassphrase.py       264)             TypeError, match='invalid safety factor: not a float'
tests/test_derivepassphrase.py       265)         ):
Marco Ricci Apply new ruff ruleset to c...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase.py       266)             assert v._estimate_sufficient_hash_length(None)  # type: ignore[arg-type]