Summary
The cqlib Python bindings (binding-python) have a core test suite in tests/python/, but some circuit API methods lack dedicated test coverage. This issue is to add integration tests for circuit construction and manipulation APIs.
What to do
Add Python tests in tests/python/ covering the following circuit operations:
-
Basic gate operations
- Test
Circuit.h(), Circuit.cx(), Circuit.x(), Circuit.y(), Circuit.z()
- Verify
num_qubits and operation count
-
Parameterized circuits
- Test
Circuit.rx(), Circuit.ry(), Circuit.rz() with Parameter
- Test
assign_parameters() with various parameter values
-
Edge cases
- Empty circuit (zero qubits)
- Large circuits (e.g., 100+ qubits)
- Invalid qubit indices
Skills needed
- Basic Python programming
- Basic understanding of quantum circuits
- Experience with
pytest is a plus
Getting started
git clone https://github.com/cq-lib/cqlib.git
cd cqlib
# Set up Python environment
python3 -m venv .venv
source .venv/bin/activate
pip install maturin pytest
# Build Python bindings
maturin develop -m crates/binding-python/Cargo.toml
# Run existing tests
pytest tests/python/ -v
# Add your tests in tests/python/ and run them
pytest tests/python/ -v
Example test
# tests/python/test_circuit_basics.py
from cqlib import Circuit
def test_bell_state():
"""Test basic Bell state construction"""
qc = Circuit(2)
qc.h(0)
qc.cx(0, 1)
assert qc.num_qubits == 2
assert len(qc.operations) == 2
Acceptance criteria
Related
Summary
The cqlib Python bindings (
binding-python) have a core test suite intests/python/, but some circuit API methods lack dedicated test coverage. This issue is to add integration tests for circuit construction and manipulation APIs.What to do
Add Python tests in
tests/python/covering the following circuit operations:Basic gate operations
Circuit.h(),Circuit.cx(),Circuit.x(),Circuit.y(),Circuit.z()num_qubitsand operation countParameterized circuits
Circuit.rx(),Circuit.ry(),Circuit.rz()withParameterassign_parameters()with various parameter valuesEdge cases
Skills needed
pytestis a plusGetting started
Example test
Acceptance criteria
assign_parameters()pytest tests/python/ -vruff checkRelated