@@ -784,12 +784,24 @@ def test_real_amplitudes(self):
784
784
expected = n_local (4 , "ry" , "cx" , "reverse_linear" , reps = 3 )
785
785
self .assertEqual (expected .assign_parameters (circuit .parameters ), circuit )
786
786
787
+ def test_real_amplitudes_numqubits_equal1 (self ):
788
+ """Test the real amplitudes circuit for a single qubit."""
789
+ circuit = real_amplitudes (1 )
790
+ expected = n_local (1 , "ry" , [])
791
+ self .assertEqual (expected .assign_parameters (circuit .parameters ), circuit )
792
+
787
793
def test_efficient_su2 (self ):
788
794
"""Test the efficient SU(2) circuit."""
789
795
circuit = efficient_su2 (4 )
790
796
expected = n_local (4 , ["ry" , "rz" ], "cx" , "reverse_linear" , reps = 3 )
791
797
self .assertEqual (expected .assign_parameters (circuit .parameters ), circuit )
792
798
799
+ def test_efficient_su2_numqubits_equal1 (self ):
800
+ """Test the efficient SU(2) circuit for a single qubit."""
801
+ circuit = efficient_su2 (1 )
802
+ expected = n_local (1 , ["ry" , "rz" ], [])
803
+ self .assertEqual (expected .assign_parameters (circuit .parameters ), circuit )
804
+
793
805
@data ("fsim" , "iswap" )
794
806
def test_excitation_preserving (self , mode ):
795
807
"""Test the excitation preserving circuit."""
@@ -808,6 +820,15 @@ def test_excitation_preserving(self, mode):
808
820
expected .assign_parameters (circuit .parameters ).decompose (), circuit .decompose ()
809
821
)
810
822
823
+ @data ("fsim" , "iswap" )
824
+ def test_excitation_preserving_numqubits_equal1 (self , mode ):
825
+ """Test the excitation preserving circuit for a single qubit."""
826
+ circuit = excitation_preserving (1 , mode = mode )
827
+ expected = n_local (1 , "rz" , [])
828
+ self .assertEqual (
829
+ expected .assign_parameters (circuit .parameters ).decompose (), circuit .decompose ()
830
+ )
831
+
811
832
def test_excitation_preserving_invalid_mode (self ):
812
833
"""Test an error is raised for an invalid mode."""
813
834
with self .assertRaises (ValueError ):
@@ -824,6 +845,14 @@ def test_two_design(self):
824
845
825
846
self .assertTrue (circuit_ops .issubset (expected_ops ))
826
847
848
+ def test_two_design_numqubits_equal1 (self ):
849
+ """Test the Pauli 2-design circuit for a single qubit."""
850
+ circuit = pauli_two_design (1 )
851
+ expected_ops = {"rx" , "ry" , "rz" , "id" }
852
+ circuit_ops = set (circuit .count_ops ().keys ())
853
+
854
+ self .assertTrue (circuit_ops .issubset (expected_ops ))
855
+
827
856
def test_two_design_seed (self ):
828
857
"""Test the seed"""
829
858
seed1 = 123
0 commit comments