def test_parse_raw_schema():
    schema = TaskMetadata(
        id="test_id",
        deviceId="device_id",
        shots=1000,
    )
    assert schema == BraketSchemaBase.parse_raw_schema(schema.json())
    assert isinstance(schema, TaskMetadata)
def test_import_schema_module():
    schema = TaskMetadata(
        id="test_id",
        deviceId="device_id",
        shots=1000,
    )
    module = BraketSchemaBase.import_schema_module(schema)
    assert schema == module.TaskMetadata.parse_raw(schema.json())
def test_correct_metadata_all(id, device_id, shots):
    device_parameters = {
        "braketSchemaHeader": {
            "name": "braket.device_schema.rigetti.rigetti_device_parameters",
            "version": "1",
        },
        "paradigmParameters": {
            "braketSchemaHeader": {
                "name": "braket.device_schema.gate_model_parameters",
                "version": "1",
            },
            "qubitCount": 1,
        },
    }
    createdAt = "2020-01-02T03:04:05.006Z"
    endedAt = "2020-01-03T03:04:05.006Z"
    status = "COMPLETED"
    failureReason = "Foo"

    metadata = TaskMetadata(
        id=id,
        deviceId=device_id,
        shots=shots,
        deviceParameters=device_parameters,
        createdAt=createdAt,
        endedAt=endedAt,
        status=status,
        failureReason=failureReason,
    )
    assert metadata.id == id
    assert metadata.deviceId == device_id
    assert metadata.shots == shots
    assert metadata.deviceParameters == device_parameters
    assert metadata.createdAt == createdAt
    assert metadata.endedAt == endedAt
    assert metadata.status == status
    assert metadata.failureReason == failureReason
    assert TaskMetadata.parse_raw(metadata.json()) == metadata
    assert metadata == TaskMetadata.parse_raw_schema(metadata.json())
def test_correct_metadata_minimum(id, device_id, shots):
    metadata = TaskMetadata(id=id, deviceId=device_id, shots=shots)
    assert metadata.id == id
    assert metadata.deviceId == device_id
    assert metadata.shots == shots
    assert TaskMetadata.parse_raw(metadata.json()) == metadata