Skip to content

Commit

Permalink
tests: Adapt to renamed exception message
Browse files Browse the repository at this point in the history
This commit fixes a test that worked on ROS2 Iron (python 3.10), but
failed on ROS2 Jazzy and Rolling (python 3.12), because the exception
message is now "Only base64 data is allowed".
  • Loading branch information
mintar committed Apr 26, 2024
1 parent 1bf1080 commit c0e24ca
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions rclpy_message_converter/test/test_message_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,14 +458,15 @@ def test_dictionary_with_uint8_array_bytes_unencoded(self):
'rclpy_message_converter_msgs/msg/Uint8ArrayTestMessage', dictionary
)
error_msg = context.exception.args[0]
self.assertIn(error_msg, ['Incorrect padding', 'Non-base64 digit found'])
self.assertIn(error_msg, ['Incorrect padding', 'Non-base64 digit found', 'Only base64 data is allowed'])

dictionary = {'data': bytes(bytearray([1, 97, 97, 2, 3, 97, 4, 97]))}
with self.assertRaises(binascii.Error) as context:
message_converter.convert_dictionary_to_ros_message(
'rclpy_message_converter_msgs/msg/Uint8ArrayTestMessage', dictionary
)
self.assertEqual('Non-base64 digit found', context.exception.args[0])
error_msg = context.exception.args[0]
self.assertIn(error_msg, ['Incorrect padding', 'Non-base64 digit found', 'Only base64 data is allowed'])

def test_dictionary_with_3uint8_array_bytes(self):
from rclpy_message_converter_msgs.msg import Uint8Array3TestMessage
Expand Down

0 comments on commit c0e24ca

Please sign in to comment.