Пример #1
0
def test_numpy_codec(request_input, payload):
    codec = NumpyCodec()
    decoded = codec.decode(request_input)

    np.testing.assert_array_equal(decoded, payload)

    response_output = codec.encode(name="foo", payload=decoded)

    assert response_output.datatype == request_input.datatype
    assert response_output.shape == request_input.shape
    assert response_output.data == request_input.data
Пример #2
0
def test_numpy_codec_to_datatype(dtype, datatype):
    codec = NumpyCodec()
    dtype = np.dtype(dtype)

    obtained_datatype = codec._to_datatype(dtype)
    assert datatype == obtained_datatype