Some of the test_decoder.py and test_encoder.py test cases fail if we change ParameterMetadata.initialize to always validate the default value type.
Repro or Code Sample
In ParameterMetadata.initialize, change
if validate_type:
_validate_default_value_type(parameter_metadata)
to
_validate_default_value_type(parameter_metadata)
Expected Behavior
Tests still pass.
Current Behavior
Float/double array tests fail because they contain ints, also see #824
FAILED tests/unit/test_decoder.py::test___serializer___deserialize_parameter___successful_deserialization[values0] - TypeError: Unexpected type <class 'int'> in the default value for 'float_array_data'. Expected type: <class 'float'>.
FAILED tests/unit/test_decoder.py::test___empty_buffer___deserialize_parameters___returns_zero_or_empty - TypeError: Unexpected type <class 'int'> in the default value for 'float_array_data'. Expected type: <class 'float'>.
FAILED tests/unit/test_encoder.py::test___serializer___serialize_parameter___successful_serialization[test_values0] - TypeError: Unexpected type <class 'int'> in the default value for 'double_array_data'. Expected type: <class 'float'>.
FAILED tests/unit/test_encoder.py::test___serializer___serialize_parameter___successful_serialization[test_values1] - TypeError: Unexpected type <class 'int'> in the default value for 'double_array_data'. Expected type: <class 'float'>.
FAILED tests/unit/test_encoder.py::test___serializer___serialize_default_parameter___successful_serialization[default_values0] - TypeError: Unexpected type <class 'int'> in the default value for 'double_array_data'. Expected type: <class 'float'>.
FAILED tests/unit/test_encoder.py::test___serializer___serialize_default_parameter___successful_serialization[default_values1] - TypeError: Unexpected type <class 'int'> in the default value for 'double_array_data'. Expected type: <class 'float'>.
FAILED tests/unit/test_encoder.py::test___serialize_parameter_multiple_times___returns_one_message_type[test_values0] - TypeError: Unexpected type <class 'int'> in the default value for 'double_array_data'. Expected type: <class 'float'>.
DoubleXYData tests fail too:
FAILED tests/unit/test_decoder.py::test___serializer___deserialize_parameter___successful_deserialization[values0] - TypeError: Unexpected type <class 'ni.protobuf.types.xydata_pb2.DoubleXYData'> in the default value for 'xy_data'. ...
FAILED tests/unit/test_decoder.py::test___empty_buffer___deserialize_parameters___returns_zero_or_empty - TypeError: Unexpected type <class 'ni.protobuf.types.xydata_pb2.DoubleXYData'> in the default value for 'xy_data'. ...
@dixonjoel Is DoubleXYData supported for configurations? Or only outputs?
Bug Report
Some of the
test_decoder.py
andtest_encoder.py
test cases fail if we changeParameterMetadata.initialize
to always validate the default value type.Repro or Code Sample
In
ParameterMetadata.initialize
, changeto
Expected Behavior
Tests still pass.
Current Behavior
Float/double array tests fail because they contain ints, also see #824
DoubleXYData tests fail too:
@dixonjoel Is
DoubleXYData
supported for configurations? Or only outputs?Possible Solution
Float/double: see #824
DoubleXYData: not sure.
Context
This came up during the code review for #807
Your Environment
ni-measurement-plugin-sdk-service
version: 1.0.0AB#2819853