Ejemplo n.º 1
0
def test_correct_result_types(
    task_metadata,
    additional_metadata_gate_model,
    measured_qubits,
    result_types,
):
    result = GateModelTaskResult(
        resultTypes=result_types,
        measuredQubits=measured_qubits,
        taskMetadata=task_metadata,
        additionalMetadata=additional_metadata_gate_model,
    )
    assert result.resultTypes == result_types
    assert GateModelTaskResult.parse_raw(result.json()) == result
Ejemplo n.º 2
0
def test_correct_result_measurement_probabilities(
    task_metadata,
    additional_metadata_gate_model,
    measured_qubits,
    measurement_probabilities,
):
    result = GateModelTaskResult(
        measurementProbabilities=measurement_probabilities,
        measuredQubits=measured_qubits,
        taskMetadata=task_metadata,
        additionalMetadata=additional_metadata_gate_model,
    )
    assert result.measurementProbabilities == measurement_probabilities
    assert GateModelTaskResult.parse_raw(result.json()) == result
Ejemplo n.º 3
0
def test_incorrect_measured_qubits(measured_qubits, task_metadata, additional_metadata_gate_model):
    GateModelTaskResult(
        measurementProbabilities=measurement_probabilities,
        measuredQubits=measured_qubits,
        taskMetadata=task_metadata,
        additionalMetadata=additional_metadata_gate_model,
    )
Ejemplo n.º 4
0
def test_incorrect_result_types(
    task_metadata,
    additional_metadata_gate_model,
    measured_qubits,
    result_types,
):
    GateModelTaskResult(
        resultTypes=result_types,
        measuredQubits=measured_qubits,
        taskMetadata=task_metadata,
        additionalMetadata=additional_metadata_gate_model,
    )
Ejemplo n.º 5
0
def test_incorrect_header(
    braket_schema_header,
    task_metadata,
    additional_metadata_gate_model,
    measured_qubits,
    measurements,
):
    GateModelTaskResult(
        braketSchemaHeader=braket_schema_header,
        measurements=measurements,
        measuredQubits=measured_qubits,
        taskMetadata=task_metadata,
        additionalMetadata=additional_metadata_gate_model,
    )
Ejemplo n.º 6
0
def test_correct_result_measurements(
    task_metadata,
    additional_metadata_gate_model,
    measured_qubits,
    measurements,
):
    result = GateModelTaskResult(
        measurements=measurements,
        measuredQubits=measured_qubits,
        taskMetadata=task_metadata,
        additionalMetadata=additional_metadata_gate_model,
    )
    assert result.measurements == measurements
    assert result.measuredQubits == measured_qubits
    assert result.taskMetadata == task_metadata
    assert result.additionalMetadata == additional_metadata_gate_model
    assert GateModelTaskResult.parse_raw(result.json()) == result
    assert result == GateModelTaskResult.parse_raw_schema(result.json())
Ejemplo n.º 7
0
def test_missing_properties():
    GateModelTaskResult()