예제 #1
0
파일: test_params.py 프로젝트: trjaffe/pyvo
def test_serialize_exceptions():
    datalink = DatalinkResults.from_result_url('http://example.com/proc')
    proc = datalink[0]
    input_params = {param.name: param for param in proc.input_params}

    polygon_conv = get_converter(find_param_by_keyword('polygon',
                                                       input_params))
    circle_conv = get_converter(find_param_by_keyword('circle', input_params))
    band_conv = get_converter(find_param_by_keyword('band', input_params))

    with pytest.raises(DALServiceError):
        polygon_conv.serialize((1, 2, 3, 4))

    with pytest.raises(DALServiceError):
        circle_conv.serialize((1, 2, 3, 4))

    with pytest.raises(DALServiceError):
        band_conv.serialize((1, 2, 3))
예제 #2
0
파일: test_params.py 프로젝트: trjaffe/pyvo
def test_serialize():
    datalink = DatalinkResults.from_result_url('http://example.com/proc')
    proc = datalink[0]
    input_params = {param.name: param for param in proc.input_params}

    polygon_conv = get_converter(find_param_by_keyword('polygon',
                                                       input_params))
    circle_conv = get_converter(find_param_by_keyword('circle', input_params))
    scale_conv = get_converter(find_param_by_keyword('scale', input_params))
    kind_conv = get_converter(find_param_by_keyword('kind', input_params))

    assert polygon_conv.serialize((1, 2, 3)) == "1 2 3"
    assert polygon_conv.serialize(np.array((1, 2, 3))) == "1 2 3"

    assert circle_conv.serialize((1.1, 2.2, 3.3)) == "1.1 2.2 3.3"
    assert circle_conv.serialize(np.array((1.1, 2.2, 3.3))) == "1.1 2.2 3.3"

    assert scale_conv.serialize(1) == "1"
    assert kind_conv.serialize("DATA") == "DATA"
예제 #3
0
def test_serialize_exceptions():
    datalink = DatalinkResults.from_result_url('http://example.com/proc')
    proc = datalink[0]
    input_params = {param.name: param for param in proc.input_params}

    polygon_conv = get_converter(
        find_param_by_keyword('polygon', input_params))
    circle_conv = get_converter(
        find_param_by_keyword('circle', input_params))
    band_conv = get_converter(
        find_param_by_keyword('band', input_params))

    with pytest.raises(DALServiceError):
        polygon_conv.serialize((1, 2, 3, 4))

    with pytest.raises(DALServiceError):
        circle_conv.serialize((1, 2, 3, 4))

    with pytest.raises(DALServiceError):
        band_conv.serialize((1, 2, 3))
예제 #4
0
def test_serialize():
    datalink = DatalinkResults.from_result_url('http://example.com/proc')
    proc = datalink[0]
    input_params = {param.name: param for param in proc.input_params}

    polygon_conv = get_converter(
        find_param_by_keyword('polygon', input_params))
    circle_conv = get_converter(
        find_param_by_keyword('circle', input_params))
    scale_conv = get_converter(
        find_param_by_keyword('scale', input_params))
    kind_conv = get_converter(
        find_param_by_keyword('kind', input_params))

    assert polygon_conv.serialize((1, 2, 3)) == "1 2 3"
    assert polygon_conv.serialize(np.array((1, 2, 3))) == "1 2 3"

    assert circle_conv.serialize((1.1, 2.2, 3.3)) == "1.1 2.2 3.3"
    assert circle_conv.serialize(np.array((1.1, 2.2, 3.3))) == "1.1 2.2 3.3"

    assert scale_conv.serialize(1) == "1"
    assert kind_conv.serialize("DATA") == "DATA"