def test_creation_from_backend_with_zero_u_channels(self): """Test creation of device specification from backend with u_channels == 0. """ class DummyBackend: """Dummy backend""" def configuration(self): # pylint: disable=missing-docstring class DummyConfig: @property def n_qubits(self): return 2 @property def n_registers(self): return 2 @property def n_uchannels(self): return 0 @property def defaults(self): return { 'qubit_freq_est': [1.2, 3.4], 'meas_freq_est': [1.2, 3.4] } return DummyConfig() device = DeviceSpecification.create_from(DummyBackend()) self.assertEqual(device.q[0].drive, DriveChannel(0, 1.2)) with self.assertRaises(PulseError): _ = device.q[0].control
def test_creation_from_backend_with_zero_u_channels(self): """Test creation of device specification from backend with u_channels == 0. """ backend = FakeOpenPulse2Q() device = DeviceSpecification.create_from(backend) self.assertEqual(device.q[0].drive, DriveChannel(0))
def test_creation_from_backend_with_zero_u_channels(self): """Test creation of device specification from backend with u_channels == 0. """ backend = FakeOpenPulse2Q() # overwrite n_uchannel backend._configuration.n_uchannels = 0 device = DeviceSpecification.create_from(backend) self.assertEqual(device.q[0].drive, DriveChannel(0, 4.9, (4.5, 5.5))) with self.assertRaises(PulseError): device.q[0].control()