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

GREEN-2058: Fixed string checking when setting invalid my_enum from dict #61

Merged
merged 1 commit into from
Feb 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion test/python/test_rticonnextdds_data_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,11 +685,16 @@ def test_bad_conversion_from_string_in_dict(self, test_output, test_dictionary):
# For each numeric field, test that set_dictionary fails when the value we
# try to set is a string that doesn't represent a number
field_names = ["my_long", "my_int64", "my_double",
"my_point_array[1].x", "my_int_sequence[1]", "my_enum", "my_uint64"]
"my_point_array[1].x", "my_int_sequence[1]", "my_uint64"]
for name in field_names:
with pytest.raises(rti.Error, match=r".*cannot convert field to string.*") as excinfo:
test_output.instance.set_dictionary({name:"not a number"})
print("Field " + name + " did not raise an exception")
# For enums, the error printed is slightly different
with pytest.raises(rti.Error, match=r".*convert enum string to numerical representation.*") as excinfo:
test_output.instance.set_dictionary({"my_enum":"not a number"})
print("Field my_enum did not raise an exception")


def test_error_in_dictionary(self, test_output, test_input):
with pytest.raises(rti.Error) as excinfo:
Expand Down