Beispiel #1
0
def test_get_available_processors_open_swim_outside_window(
        schedule_mock, time_mock, engine_mock):
    os.environ['GOOGLE_CLOUD_PROJECT'] = 'some_project'
    schedule_mock.return_value = [
        qtypes.QuantumTimeSlot(
            processor_name='Sycamore23',
            start_time=Timestamp(seconds=300),
            end_time=Timestamp(seconds=500),
            slot_type=enums.QuantumTimeSlot.TimeSlotType.OPEN_SWIM)
    ]
    time_mock.return_value = datetime.fromtimestamp(700)
    assert recirq.get_available_processors(['Sycamore23']) == []
Beispiel #2
0
def test_get_available_processors_other_project_reservation(
        schedule_mock, time_mock, engine_mock):
    os.environ['GOOGLE_CLOUD_PROJECT'] = 'some_project'
    schedule_mock.return_value = [
        qtypes.QuantumTimeSlot(
            processor_name='Sycamore23',
            start_time=Timestamp(seconds=100),
            end_time=Timestamp(seconds=500),
            slot_type=enums.QuantumTimeSlot.TimeSlotType.RESERVATION,
            reservation_config=qtypes.QuantumTimeSlot.ReservationConfig(
                project_id='other_project'),
        )
    ]
    time_mock.return_value = datetime.fromtimestamp(300)
    assert recirq.get_available_processors(['Sycamore23']) == []