Skip to content

Commit f7dcbae

Browse files
committed
🎨 Address CodeRabbit's suggestions
1 parent e922878 commit f7dcbae

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

test/python/plugins/qiskit/test_estimator.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,19 +162,17 @@ def test_estimator_broadcasting(backend_with_mock_jobs: QDMIBackend) -> None:
162162
# 2 Observables
163163
ops = [SparsePauliOp("Z"), SparsePauliOp("X")]
164164

165-
# 3 Parameter sets
166-
# Broadcast: 2 observables x 3 parameters.
167-
# To test broadcasting, we reshape to make them compatible for outer product.
168-
# Params: shape (3, 1) (via bindings array reshape or just repeating ops)
169-
# But EstimatorPub.coerce is strict.
170-
# Let's align shapes to (2,) for simplicity in this test
165+
# 2 Parameter sets (shape (2,) / two values)
166+
# Test asserts broadcasting for 2 observables x 2 parameter sets
167+
# We align shapes to (2,) so they broadcast element-wise.
171168
vals = [[0.0], [np.pi]]
172169

173170
pub = EstimatorPub.coerce((qc, ops, vals)) # type: ignore[arg-type]
174171
job = estimator.run([pub])
175172
result = job.result()
176173

177174
data = cast("Any", result[0].data)
175+
# Shape expectations: (2,) result from broadcasting
178176
assert data.evs.shape == (2,)
179177
assert data.stds.shape == (2,)
180178

0 commit comments

Comments
 (0)