Skip to content

Commit

Permalink
test.python.transpiler.test_coupling.CouplingTest.test_neighbors
Browse files Browse the repository at this point in the history
  • Loading branch information
Luciano Bello committed Jun 20, 2020
1 parent cb7ef39 commit 010c09a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/python/transpiler/test_coupling.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@ def test_make_symmetric(self):

self.assertEqual(set(edges), set([(0, 1), (0, 2), (2, 0), (1, 0)]))

def test_neighbors(self):
coupling_list = [[0, 1], [0, 2], [2, 0]]
coupling = CouplingMap(coupling_list)

physical_qubits = coupling.physical_qubits
self.assertEqual(set(coupling.neighbors(physical_qubits[0])), set([1, 2]))
self.assertEqual(set(coupling.neighbors(physical_qubits[1])), set([]))
self.assertEqual(set(coupling.neighbors(physical_qubits[2])), set([0]))

def test_full_factory(self):
coupling = CouplingMap.from_full(4)
edges = coupling.get_edges()
Expand Down

0 comments on commit 010c09a

Please sign in to comment.