Skip to content

Commit 280b82e

Browse files
committed
test: test different extractors
1 parent 338f13b commit 280b82e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tests/instruments/test_qrng.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@
22
import pytest
33
from serial.serialutil import SerialException
44

5-
from qibolab.instruments.qrng import QRNG
5+
from qibolab.instruments.qrng import QRNG, ShaExtractor, ToeplitzExtractor
66

77
RAW_BITS = 12
88
"""Number of bits in each QRNG sample."""
99

1010

1111
@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)
1419
try:
1520
qrng.connect()
1621
except SerialException:
@@ -22,6 +27,7 @@ def read(n):
2227
return qrng
2328

2429

30+
@pytest.mark.parametrize("extractor", [ShaExtractor(), ToeplitzExtractor()])
2531
def test_qrng_random(qrng):
2632
data = qrng.random(1000)
2733
assert isinstance(data, np.ndarray)

0 commit comments

Comments
 (0)