0bdfe96ea10f82e3e3f91b5cddfd92369d7bf180
Marco Ricci Change the author e-mail ad...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_sequin.py   1) # SPDX-FileCopyrightText: 2024 Marco Ricci <software@the13thletter.info>
Marco Ricci Add unit tests, both new an...

Marco Ricci authored 5 months ago

tests/test_sequin.py                    2) #
tests/test_sequin.py                    3) # SPDX-License-Identifier: MIT
tests/test_sequin.py                    4) 
tests/test_sequin.py                    5) """Test sequin.Sequin."""
tests/test_sequin.py                    6) 
Marco Ricci Fix awkward parametrization...

Marco Ricci authored 1 month ago

tests/test_derivepassphrase_sequin.py   7) from __future__ import annotations
tests/test_derivepassphrase_sequin.py   8) 
Marco Ricci Rename and regroup all test...

Marco Ricci authored 4 months ago

tests/test_sequin.py                    9) import collections
Marco Ricci Add unit tests, both new an...

Marco Ricci authored 5 months ago

tests/test_sequin.py                   10) 
Marco Ricci Rename and regroup all test...

Marco Ricci authored 4 months ago

tests/test_sequin.py                   11) import pytest
Marco Ricci Fix style issues with ruff...

Marco Ricci authored 3 months ago

tests/test_sequin.py                   12) 
Marco Ricci Move `sequin` and `ssh_agen...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_sequin.py  13) from derivepassphrase import sequin
Marco Ricci Add unit tests, both new an...

Marco Ricci authored 5 months ago

tests/test_sequin.py                   14) 
Marco Ricci Fix style issues with ruff...

Marco Ricci authored 3 months ago

tests/test_sequin.py                   15) 
Marco Ricci Add bitseq function in test...

Marco Ricci authored 3 months ago

tests/test_sequin.py                   16) def bitseq(string: str) -> list[int]:
tests/test_sequin.py                   17)     """Convert a 0/1-string into a list of bits."""
tests/test_sequin.py                   18)     return [int(char, 2) for char in string]
tests/test_sequin.py                   19) 
tests/test_sequin.py                   20) 
Marco Ricci Rename and regroup all test...

Marco Ricci authored 4 months ago

tests/test_sequin.py                   21) class TestStaticFunctionality:
Marco Ricci Reformat everything with ruff

Marco Ricci authored 3 months ago

tests/test_sequin.py                   22)     @pytest.mark.parametrize(
tests/test_sequin.py                   23)         ['sequence', 'base', 'expected'],
tests/test_sequin.py                   24)         [
tests/test_sequin.py                   25)             ([1, 2, 3, 4, 5, 6], 10, 123456),
tests/test_sequin.py                   26)             ([1, 2, 3, 4, 5, 6], 100, 10203040506),
tests/test_sequin.py                   27)             ([0, 0, 1, 4, 9, 7], 10, 1497),
tests/test_sequin.py                   28)             ([1, 0, 0, 1, 0, 0, 0, 0], 2, 144),
tests/test_sequin.py                   29)             ([1, 7, 5, 5], 8, 0o1755),
tests/test_sequin.py                   30)         ],
tests/test_sequin.py                   31)     )
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 3 months ago

tests/test_sequin.py                   32)     def test_200_big_endian_number(
tests/test_sequin.py                   33)         self, sequence: list[int], base: int, expected: int
tests/test_sequin.py                   34)     ) -> None:
Marco Ricci Rename and regroup all test...

Marco Ricci authored 4 months ago

tests/test_sequin.py                   35)         assert (
tests/test_sequin.py                   36)             sequin.Sequin._big_endian_number(sequence, base=base)
tests/test_sequin.py                   37)         ) == expected
Marco Ricci Add unit tests, both new an...

Marco Ricci authored 5 months ago

tests/test_sequin.py                   38) 
Marco Ricci Rename and regroup all test...

Marco Ricci authored 4 months ago

tests/test_sequin.py                   39)     @pytest.mark.parametrize(
Marco Ricci Reformat everything with ruff

Marco Ricci authored 3 months ago

tests/test_sequin.py                   40)         ['exc_type', 'exc_pattern', 'sequence', 'base'],
tests/test_sequin.py                   41)         [
Marco Ricci Rename and regroup all test...

Marco Ricci authored 4 months ago

tests/test_sequin.py                   42)             (ValueError, 'invalid base 3 digit:', [-1], 3),
tests/test_sequin.py                   43)             (ValueError, 'invalid base:', [0], 1),
tests/test_sequin.py                   44)             (TypeError, 'not an integer:', [0.0, 1.0, 0.0, 1.0], 2),
Marco Ricci Reformat everything with ruff

Marco Ricci authored 3 months ago

tests/test_sequin.py                   45)         ],
Marco Ricci Rename and regroup all test...

Marco Ricci authored 4 months ago

tests/test_sequin.py                   46)     )
Marco Ricci Reformat everything with ruff

Marco Ricci authored 3 months ago

tests/test_sequin.py                   47)     def test_300_big_endian_number_exceptions(
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 3 months ago

tests/test_sequin.py                   48)         self,
tests/test_sequin.py                   49)         exc_type: type[Exception],
tests/test_sequin.py                   50)         exc_pattern: str,
tests/test_sequin.py                   51)         sequence: list[int],
tests/test_sequin.py                   52)         base: int,
tests/test_sequin.py                   53)     ) -> None:
Marco Ricci Rename and regroup all test...

Marco Ricci authored 4 months ago

tests/test_sequin.py                   54)         with pytest.raises(exc_type, match=exc_pattern):
tests/test_sequin.py                   55)             sequin.Sequin._big_endian_number(sequence, base=base)
Marco Ricci Add unit tests, both new an...

Marco Ricci authored 5 months ago

tests/test_sequin.py                   56) 
tests/test_sequin.py                   57) 
Marco Ricci Reformat everything with ruff

Marco Ricci authored 3 months ago

tests/test_sequin.py                   58) class TestSequin:
tests/test_sequin.py                   59)     @pytest.mark.parametrize(
tests/test_sequin.py                   60)         ['sequence', 'is_bitstring', 'expected'],
tests/test_sequin.py                   61)         [
tests/test_sequin.py                   62)             (
tests/test_sequin.py                   63)                 [1, 0, 0, 1, 0, 1],
tests/test_sequin.py                   64)                 False,
Marco Ricci Add bitseq function in test...

Marco Ricci authored 3 months ago

tests/test_sequin.py                   65)                 bitseq('000000010000000000000000000000010000000000000001'),
Marco Ricci Reformat everything with ruff

Marco Ricci authored 3 months ago

tests/test_sequin.py                   66)             ),
tests/test_sequin.py                   67)             ([1, 0, 0, 1, 0, 1], True, [1, 0, 0, 1, 0, 1]),
Marco Ricci Add bitseq function in test...

Marco Ricci authored 3 months ago

tests/test_sequin.py                   68)             (b'OK', False, bitseq('0100111101001011')),
tests/test_sequin.py                   69)             ('OK', False, bitseq('0100111101001011')),
Marco Ricci Reformat everything with ruff

Marco Ricci authored 3 months ago

tests/test_sequin.py                   70)         ],
tests/test_sequin.py                   71)     )
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 3 months ago

tests/test_sequin.py                   72)     def test_200_constructor(
tests/test_sequin.py                   73)         self,
tests/test_sequin.py                   74)         sequence: str | bytes | bytearray | list[int],
tests/test_sequin.py                   75)         is_bitstring: bool,
tests/test_sequin.py                   76)         expected: list[int],
tests/test_sequin.py                   77)     ) -> None:
Marco Ricci Rename and regroup all test...

Marco Ricci authored 4 months ago

tests/test_sequin.py                   78)         seq = sequin.Sequin(sequence, is_bitstring=is_bitstring)
tests/test_sequin.py                   79)         assert seq.bases == {2: collections.deque(expected)}
Marco Ricci Add unit tests, both new an...

Marco Ricci authored 5 months ago

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

Marco Ricci authored 3 months ago

tests/test_sequin.py                   81)     def test_201_generating(self) -> None:
Marco Ricci Reformat everything with ruff

Marco Ricci authored 3 months ago

tests/test_sequin.py                   82)         seq = sequin.Sequin(
tests/test_sequin.py                   83)             [1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1], is_bitstring=True
tests/test_sequin.py                   84)         )
Marco Ricci Rename and regroup all test...

Marco Ricci authored 4 months ago

tests/test_sequin.py                   85)         assert seq.generate(1) == 0
tests/test_sequin.py                   86)         assert seq.generate(5) == 3
tests/test_sequin.py                   87)         assert seq.generate(5) == 3
tests/test_sequin.py                   88)         assert seq.generate(5) == 1
Marco Ricci Rename SequinExhaustedExcep...

Marco Ricci authored 4 months ago

tests/test_sequin.py                   89)         with pytest.raises(sequin.SequinExhaustedError):
Marco Ricci Rename and regroup all test...

Marco Ricci authored 4 months ago

tests/test_sequin.py                   90)             seq.generate(5)
Marco Ricci Rename SequinExhaustedExcep...

Marco Ricci authored 4 months ago

tests/test_sequin.py                   91)         with pytest.raises(sequin.SequinExhaustedError):
Marco Ricci Rename and regroup all test...

Marco Ricci authored 4 months ago

tests/test_sequin.py                   92)             seq.generate(1)
Marco Ricci Reformat everything with ruff

Marco Ricci authored 3 months ago

tests/test_sequin.py                   93)         seq = sequin.Sequin(
tests/test_sequin.py                   94)             [1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1], is_bitstring=True
tests/test_sequin.py                   95)         )
Marco Ricci Rename and regroup all test...

Marco Ricci authored 4 months ago

tests/test_sequin.py                   96)         with pytest.raises(ValueError, match='invalid target range'):
tests/test_sequin.py                   97)             seq.generate(0)
Marco Ricci Add unit tests, both new an...

Marco Ricci authored 5 months ago

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

Marco Ricci authored 3 months ago

tests/test_sequin.py                   99)     def test_210_internal_generating(self) -> None:
Marco Ricci Reformat everything with ruff

Marco Ricci authored 3 months ago

tests/test_sequin.py                  100)         seq = sequin.Sequin(
tests/test_sequin.py                  101)             [1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1], is_bitstring=True
tests/test_sequin.py                  102)         )
Marco Ricci Rename and regroup all test...

Marco Ricci authored 4 months ago

tests/test_sequin.py                  103)         assert seq._generate_inner(5) == 3
tests/test_sequin.py                  104)         assert seq._generate_inner(5) == 3
tests/test_sequin.py                  105)         assert seq._generate_inner(5) == 1
tests/test_sequin.py                  106)         assert seq._generate_inner(5) == 5
tests/test_sequin.py                  107)         assert seq._generate_inner(1) == 0
Marco Ricci Reformat everything with ruff

Marco Ricci authored 3 months ago

tests/test_sequin.py                  108)         seq = sequin.Sequin(
tests/test_sequin.py                  109)             [1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1], is_bitstring=True
tests/test_sequin.py                  110)         )
Marco Ricci Rename and regroup all test...

Marco Ricci authored 4 months ago

tests/test_sequin.py                  111)         assert seq._generate_inner(1) == 0
tests/test_sequin.py                  112)         with pytest.raises(ValueError, match='invalid target range'):
tests/test_sequin.py                  113)             seq._generate_inner(0)
tests/test_sequin.py                  114)         with pytest.raises(ValueError, match='invalid base:'):
tests/test_sequin.py                  115)             seq._generate_inner(16, base=1)
Marco Ricci Add unit tests, both new an...

Marco Ricci authored 5 months ago

tests/test_sequin.py                  116) 
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 3 months ago

tests/test_sequin.py                  117)     def test_211_shifting(self) -> None:
Marco Ricci Rename and regroup all test...

Marco Ricci authored 4 months ago

tests/test_sequin.py                  118)         seq = sequin.Sequin([1, 0, 1, 0, 0, 1, 0, 0, 0, 1], is_bitstring=True)
Marco Ricci Reformat everything with ruff

Marco Ricci authored 3 months ago

tests/test_sequin.py                  119)         assert seq.bases == {
tests/test_sequin.py                  120)             2: collections.deque([1, 0, 1, 0, 0, 1, 0, 0, 0, 1])
tests/test_sequin.py                  121)         }
Marco Ricci Fix style issues with ruff...

Marco Ricci authored 3 months ago

tests/test_sequin.py                  122) 
Marco Ricci Rename and regroup all test...

Marco Ricci authored 4 months ago

tests/test_sequin.py                  123)         assert seq._all_or_nothing_shift(3) == (1, 0, 1)
tests/test_sequin.py                  124)         assert seq._all_or_nothing_shift(3) == (0, 0, 1)
tests/test_sequin.py                  125)         assert seq.bases[2] == collections.deque([0, 0, 0, 1])
Marco Ricci Fix style issues with ruff...

Marco Ricci authored 3 months ago

tests/test_sequin.py                  126) 
Marco Ricci Rename and regroup all test...

Marco Ricci authored 4 months ago

tests/test_sequin.py                  127)         assert seq._all_or_nothing_shift(5) == ()
tests/test_sequin.py                  128)         assert seq.bases[2] == collections.deque([0, 0, 0, 1])
Marco Ricci Fix style issues with ruff...

Marco Ricci authored 3 months ago

tests/test_sequin.py                  129) 
Marco Ricci Rename and regroup all test...

Marco Ricci authored 4 months ago

tests/test_sequin.py                  130)         assert seq._all_or_nothing_shift(4), (0, 0, 0, 1)
tests/test_sequin.py                  131)         assert 2 not in seq.bases
Marco Ricci Add unit tests, both new an...

Marco Ricci authored 5 months ago

tests/test_sequin.py                  132) 
Marco Ricci Rename and regroup all test...

Marco Ricci authored 4 months ago

tests/test_sequin.py                  133)     @pytest.mark.parametrize(
tests/test_sequin.py                  134)         ['sequence', 'is_bitstring', 'exc_type', 'exc_pattern'],
tests/test_sequin.py                  135)         [
Marco Ricci Reformat everything with ruff

Marco Ricci authored 3 months ago

tests/test_sequin.py                  136)             (
tests/test_sequin.py                  137)                 [0, 1, 2, 3, 4, 5, 6, 7],
tests/test_sequin.py                  138)                 True,
tests/test_sequin.py                  139)                 ValueError,
tests/test_sequin.py                  140)                 'sequence item out of range',
tests/test_sequin.py                  141)             ),
tests/test_sequin.py                  142)             ('こんにちは。', False, ValueError, 'sequence item out of range'),
tests/test_sequin.py                  143)         ],
Marco Ricci Rename and regroup all test...

Marco Ricci authored 4 months ago

tests/test_sequin.py                  144)     )
Marco Ricci Reformat everything with ruff

Marco Ricci authored 3 months ago

tests/test_sequin.py                  145)     def test_300_constructor_exceptions(
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 3 months ago

tests/test_sequin.py                  146)         self,
tests/test_sequin.py                  147)         sequence: list[int] | str,
tests/test_sequin.py                  148)         is_bitstring: bool,
tests/test_sequin.py                  149)         exc_type: type[Exception],
tests/test_sequin.py                  150)         exc_pattern: str,
tests/test_sequin.py                  151)     ) -> None: