Marco Ricci commited on 2024-07-22 13:23:35
Zeige 1 geänderte Dateien mit 8 Einfügungen und 52 Löschungen.
... | ... |
@@ -11,6 +11,11 @@ import pytest |
11 | 11 |
import sequin |
12 | 12 |
|
13 | 13 |
|
14 |
+def bitseq(string: str) -> list[int]: |
|
15 |
+ """Convert a 0/1-string into a list of bits.""" |
|
16 |
+ return [int(char, 2) for char in string] |
|
17 |
+ |
|
18 |
+ |
|
14 | 19 |
class TestStaticFunctionality: |
15 | 20 |
@pytest.mark.parametrize( |
16 | 21 |
['sequence', 'base', 'expected'], |
... | ... |
@@ -49,60 +54,11 @@ class TestSequin: |
49 | 54 |
( |
50 | 55 |
[1, 0, 0, 1, 0, 1], |
51 | 56 |
False, |
52 |
- [ |
|
53 |
- 0, |
|
54 |
- 0, |
|
55 |
- 0, |
|
56 |
- 0, |
|
57 |
- 0, |
|
58 |
- 0, |
|
59 |
- 0, |
|
60 |
- 1, |
|
61 |
- 0, |
|
62 |
- 0, |
|
63 |
- 0, |
|
64 |
- 0, |
|
65 |
- 0, |
|
66 |
- 0, |
|
67 |
- 0, |
|
68 |
- 0, |
|
69 |
- 0, |
|
70 |
- 0, |
|
71 |
- 0, |
|
72 |
- 0, |
|
73 |
- 0, |
|
74 |
- 0, |
|
75 |
- 0, |
|
76 |
- 0, |
|
77 |
- 0, |
|
78 |
- 0, |
|
79 |
- 0, |
|
80 |
- 0, |
|
81 |
- 0, |
|
82 |
- 0, |
|
83 |
- 0, |
|
84 |
- 1, |
|
85 |
- 0, |
|
86 |
- 0, |
|
87 |
- 0, |
|
88 |
- 0, |
|
89 |
- 0, |
|
90 |
- 0, |
|
91 |
- 0, |
|
92 |
- 0, |
|
93 |
- 0, |
|
94 |
- 0, |
|
95 |
- 0, |
|
96 |
- 0, |
|
97 |
- 0, |
|
98 |
- 0, |
|
99 |
- 0, |
|
100 |
- 1, |
|
101 |
- ], |
|
57 |
+ bitseq('000000010000000000000000000000010000000000000001'), |
|
102 | 58 |
), |
103 | 59 |
([1, 0, 0, 1, 0, 1], True, [1, 0, 0, 1, 0, 1]), |
104 |
- (b'OK', False, [0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1]), |
|
105 |
- ('OK', False, [0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1]), |
|
60 |
+ (b'OK', False, bitseq('0100111101001011')), |
|
61 |
+ ('OK', False, bitseq('0100111101001011')), |
|
106 | 62 |
], |
107 | 63 |
) |
108 | 64 |
def test_200_constructor(self, sequence, is_bitstring, expected): |
109 | 65 |