def test_gates(self):
        """Test generated gates."""
        fake_backend = ConfigurableFakeBackend("Tashkent", n_qubits=4)
        properties = fake_backend.properties()

        self.assertEqual(len(properties.gates), 22)

        fake_backend = ConfigurableFakeBackend(
            "Tashkent", n_qubits=4, basis_gates=["u1", "u2", "cx"]
        )
        properties = fake_backend.properties()

        self.assertEqual(len(properties.gates), 14)
        self.assertEqual(len([g for g in properties.gates if g.gate == "cx"]), 6)
    def test_set_parameters(self):
        """Test parameters setting."""
        for n_qubits in range(10, 100, 30):
            with self.subTest(n_qubits=n_qubits):
                fake_backend = ConfigurableFakeBackend(
                    "Tashkent",
                    n_qubits=n_qubits,
                    version="0.0.1",
                    basis_gates=['u1'],
                    qubit_t1=99.,
                    qubit_t2=146.,
                    qubit_frequency=5.,
                    qubit_readout_error=0.01,
                    single_qubit_gates=['u1'])

                properties = fake_backend.properties()
                self.assertEqual(properties.backend_version, "0.0.1")
                self.assertEqual(properties.backend_name, "Tashkent")
                self.assertEqual(len(properties.qubits), n_qubits)
                self.assertEqual(len(properties.gates), n_qubits)

                configuration = fake_backend.configuration()
                self.assertEqual(configuration.backend_version, "0.0.1")
                self.assertEqual(configuration.backend_name, "Tashkent")
                self.assertEqual(configuration.n_qubits, n_qubits)
                self.assertEqual(configuration.basis_gates, ['u1'])
    def test_default_parameters(self):
        """Test default parameters."""
        fake_backend = ConfigurableFakeBackend("Tashkent", n_qubits=10)

        properties = fake_backend.properties()
        self.assertEqual(len(properties.qubits), 10)
        self.assertEqual(properties.backend_version, "0.0.0")
        self.assertEqual(properties.backend_name, "Tashkent")

        configuration = fake_backend.configuration()
        self.assertEqual(configuration.backend_version, "0.0.0")
        self.assertEqual(configuration.backend_name, "Tashkent")
        self.assertEqual(configuration.n_qubits, 10)
        self.assertEqual(configuration.basis_gates, ["id", "u1", "u2", "u3", "cx"])
        self.assertTrue(configuration.local)
        self.assertTrue(configuration.open_pulse)