示例#1
0
def test_axis_serialization():
    # We do a round robin serialization run with an axis and make sure that they match
    axis = ng.make_axis(name='C', length=2)
    pb_axis = ser.axis_to_protobuf(axis)
    py_axis = ser.pb_to_axis(pb_axis)
    assert axis.length == py_axis.length
    assert axis.name == py_axis.name
    assert axis == py_axis
示例#2
0
def test_flattenedaxis_serialization():
    # We do a round robin serialization run with an axis and make sure that they match
    c = ng.make_axis(name='C', length=2)
    h = ng.make_axis(name='H', length=3)
    orig_axis = ng.make_axes([c, h]).flatten()

    pb_axis = ser.axis_to_protobuf(orig_axis)
    py_axis = ser.pb_to_axis(pb_axis)
    assert py_axis.length == orig_axis.length
    # NameableValue name counter is different
    # assert orig_axis.name == py_axis.name
    assert type(py_axis) == type(orig_axis)
    assert orig_axis == py_axis