Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_decoder.py and test_encoder.py test cases have invalid default values #825

Closed
bkeryan opened this issue Aug 1, 2024 · 1 comment · Fixed by #832
Closed

test_decoder.py and test_encoder.py test cases have invalid default values #825

bkeryan opened this issue Aug 1, 2024 · 1 comment · Fixed by #832
Labels
bug Something isn't working triage New issue that needs to be reviewed

Comments

@bkeryan
Copy link
Collaborator

bkeryan commented Aug 1, 2024

Bug Report

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?

Possible Solution

Float/double: see #824

DoubleXYData: not sure.

Context

This came up during the code review for #807

Your Environment

  • OS & Device: Windows
  • ni-measurement-plugin-sdk-service version: 1.0.0
  • MeasurementLink version: 24.8.x
  • Python version: 3.9

AB#2819853

@bkeryan bkeryan added bug Something isn't working triage New issue that needs to be reviewed labels Aug 1, 2024
@dixonjoel
Copy link
Collaborator

@bkeryan We haven't made any effort to support DoubleXYData for inputs so I'm not surprised this fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage New issue that needs to be reviewed
Projects
None yet
2 participants