Commit 280b82e 1 parent 338f13b commit 280b82e Copy full SHA for 280b82e
File tree 1 file changed +9
-3
lines changed
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 2
2
import pytest
3
3
from serial .serialutil import SerialException
4
4
5
- from qibolab .instruments .qrng import QRNG
5
+ from qibolab .instruments .qrng import QRNG , ShaExtractor , ToeplitzExtractor
6
6
7
7
RAW_BITS = 12
8
8
"""Number of bits in each QRNG sample."""
9
9
10
10
11
11
@pytest .fixture
12
- def qrng (mocker ):
13
- qrng = QRNG (address = "/dev/ttyACM0" )
12
+ def extractor ():
13
+ return ShaExtractor ()
14
+
15
+
16
+ @pytest .fixture
17
+ def qrng (mocker , extractor ):
18
+ qrng = QRNG (address = "/dev/ttyACM0" , extractor = extractor )
14
19
try :
15
20
qrng .connect ()
16
21
except SerialException :
@@ -22,6 +27,7 @@ def read(n):
22
27
return qrng
23
28
24
29
30
+ @pytest .mark .parametrize ("extractor" , [ShaExtractor (), ToeplitzExtractor ()])
25
31
def test_qrng_random (qrng ):
26
32
data = qrng .random (1000 )
27
33
assert isinstance (data , np .ndarray )
You can’t perform that action at this time.
0 commit comments