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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions test/python/test_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ def test_math_domain_error(self):
"""
self.qp.load_qasm_file(self._get_resource_path('qasm/math_domain_error.qasm'), name='test')
coupling_map = [[0, 2], [1, 2], [2, 3]]
result1 = self.qp.execute(["test"], backend="local_qasm_simulator",
coupling_map=coupling_map, seed=self.seed)

self.assertEqual(result1.get_counts("test"), {'0001': 480, '0101': 544})
shots = 2000
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
self.assertDictAlmostEqual(counts, target, threshold)

def test_optimize_1q_gates_issue159(self):
"""Test change in behavior for optimize_1q_gates that removes u1(2*pi) rotations.
Expand Down