Make tests in test_noisy_density_matrix.py use the BranchSelector feature#425
Make tests in test_noisy_density_matrix.py use the BranchSelector feature#425tibisabau wants to merge 9 commits intoTeamGraphix:masterfrom
test_noisy_density_matrix.py use the BranchSelector feature#425Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #425 +/- ##
=======================================
Coverage 88.76% 88.76%
=======================================
Files 44 44
Lines 6308 6308
=======================================
Hits 5599 5599
Misses 709 709 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@tibisabau Thank you for your last commits. I pointed just the first occurrences of each problem, but you need to solve all the other occurrences for |
tests/test_noisy_density_matrix.py
Outdated
There was a problem hiding this comment.
My previous comment (#425 (comment)) applies here and lines 410 and below as well: in particular, we don't need to use cast here.
tests/test_noisy_density_matrix.py
Outdated
There was a problem hiding this comment.
For homogeneity, I would prefer if we do the same here as for line 324 (and this applies to line 398 and 442 too).
|
@tibisabau thanks for your PR! While checking it, we realised that the behaviour in the test was the one we wanted but not the one taht was implemented. Son instead of making the tests fit the implementation, we'll modify the implementation see #428 for more details. Thanks again and keep an eye on further developments! |
|
Thanks @tibisabau for updating the PR. It looks good! However I still see previous history in your PR. Do you know why that is? If you can't fix it, it will disappear when squashing and merging anyways. Graphix requires 2 approvals before merging so another colleague will take a look soon. Thanks again for conributing! |
Co-authored-by: thierry-martinez <thierry.martinez@inria.fr>
Co-authored-by: thierry-martinez <thierry.martinez@inria.fr>
Co-authored-by: thierry-martinez <thierry.martinez@inria.fr>
Co-authored-by: thierry-martinez <thierry.martinez@inria.fr>
b8c62a7 to
737d36d
Compare
Before submitting, please check the following:
nox)ruffCONTRIBUTING.mdfor more detailsThen, please fill in below:
Context (if applicable):
The noisy density matrix backend tests in
test_noisy_density_matrix.pywere non-deterministic because they relied on random measurement outcomes. These tests usedorconditions to check multiple possible outcomes, making them fail intermittently. The BranchSelector feature (introduced in PR #300) allows fixing measurement outcomes deterministically.Description of the change:
Modified all affected tests in
test_noisy_density_matrix.pyto useBranchSelector(ConstBranchSelectorandFixedBranchSelector) to fix measurement outcomes, making the tests fully deterministic. Updated test logic based on understanding that noise channels are applied unconditionally after correction commands in the depolarising noise model.Related issue:
Fixes #416