From 5eadae405bdca05b3f23ac846323d0469000ac75 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Wed, 30 Mar 2022 09:43:32 -0400 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Jake Lishman --- qiskit/transpiler/passes/synthesis/unitary_synthesis.py | 4 ++-- test/python/transpiler/test_unitary_synthesis.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/qiskit/transpiler/passes/synthesis/unitary_synthesis.py b/qiskit/transpiler/passes/synthesis/unitary_synthesis.py index 9b711b7e3fc2..867c68119c7f 100644 --- a/qiskit/transpiler/passes/synthesis/unitary_synthesis.py +++ b/qiskit/transpiler/passes/synthesis/unitary_synthesis.py @@ -506,7 +506,7 @@ def run(self, unitary, **options): decomposer1q = None preferred_direction = None - if target: + if target is not None: decomposer2q, preferred_direction = self._find_decomposer_2q_from_target( target, qubits, pulse_optimize ) @@ -558,7 +558,7 @@ def _synth_natural_direction( physical_gate_fidelity = None wires = None if natural_direction in {None, True} and ( - coupling_map or (target and decomposer2q and not preferred_direction) + coupling_map or (target is not None and decomposer2q and not preferred_direction) ): cmap = coupling_map neighbors0 = cmap.neighbors(qubits[0]) diff --git a/test/python/transpiler/test_unitary_synthesis.py b/test/python/transpiler/test_unitary_synthesis.py index e96412104d62..8e1fbf1dc222 100644 --- a/test/python/transpiler/test_unitary_synthesis.py +++ b/test/python/transpiler/test_unitary_synthesis.py @@ -581,7 +581,7 @@ def test_coupling_map_transpile(self, opt): bidirectional=[True, False], dsc=( "test natural_direction works with transpile using opt_level {opt_level} on" - "target with multiple 2q gates with bidirectional={bidirectional}" + " target with multiple 2q gates with bidirectional={bidirectional}" ), name="opt_level_{opt_level}_bidirectional_{bidirectional}", ) @@ -627,7 +627,7 @@ def test_coupling_map_unequal_durations(self, opt): bidirectional=[True, False], dsc=( "Test direction with transpile using opt_level {opt_level} on" - "target with multiple 2q gates with bidirectional={bidirectional}" + " target with multiple 2q gates with bidirectional={bidirectional}" ), name="opt_level_{opt_level}_bidirectional_{bidirectional}", ) @@ -657,7 +657,7 @@ def test_coupling_unequal_duration_with_backendv2(self, opt_level, bidirectional opt_level=[0, 1, 2, 3], dsc=( "Test direction with transpile using opt_level {opt_level} on" - "target with multiple 2q gates" + " target with multiple 2q gates" ), name="opt_level_{opt_level}", )