Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use assertDictAlmostEqual in test_mapper #390

Merged
merged 2 commits into from Apr 9, 2018

Conversation

ajavadia
Copy link
Member

@ajavadia ajavadia commented Apr 7, 2018

Seems like one test case was missed in #380 when we updated tests to allow tolerance intervals instead of exact comparisons.
This PR covers that.

Description

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

coupling_map=coupling_map,
seed=self.seed, shots=1024)
counts = result.get_counts("test")
target = {'0001': 480, '0101': 544}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for this circuit the ideal counts should be shots / 2. Can you change this block to:

shots = 1024
result = self.qp.execute("test", backend="local_qasm_simulator",
                                 coupling_map=coupling_map,
                                 seed=self.seed, shots=shots)
counts = result.get_counts("test")
target = {'0001': shots / 2, '0101':  shots / 2}
threshold = 0.025 * shots

and check if the test still passes (you might need to increase the shots or adjust the threshold a little bit)

@chriseclectic chriseclectic merged commit 993b2e4 into Qiskit:master Apr 9, 2018
@ajavadia ajavadia deleted the fix-test-mapper branch July 21, 2018 00:12
lia-approves pushed a commit to edasgupta/qiskit-terra that referenced this pull request Jul 30, 2019
use assertDictAlmostEqual in test_mapper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants