@@ -93,3 +93,49 @@ def test_create_instance_handle_from_list_with_more_elements():
9393 ih .value = [1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 ]
9494 repr = exception .getrepr ()
9595 assert str (repr ).split ("\n " )[0 ] == "ValueError: Expected 16 elements"
96+
97+
98+ def test_create_instance_handle_from_bytearray_with_with_negative_number ():
99+ ih = fastdds .InstanceHandle_t ()
100+ with pytest .raises (ValueError ) as exception :
101+ ih .value = bytearray ([1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , - 10 , 11 , 12 , 13 , 14 , 15 , 16 ])
102+ assert str (exception .value ) == "byte must be in range(0, 256)"
103+
104+
105+ def test_create_instance_handle_from_bytearray_with_large_number ():
106+ ih = fastdds .InstanceHandle_t ()
107+ with pytest .raises (ValueError ) as exception :
108+ ih .value = bytearray ([1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 1000 , 11 , 12 , 13 , 14 , 15 , 16 ])
109+ assert str (exception .value ) == "byte must be in range(0, 256)"
110+
111+
112+ def test_create_instance_handle_from_tuple_with_negative_number ():
113+ ih = fastdds .InstanceHandle_t ()
114+ with pytest .raises (SystemError ) as exception :
115+ ih .value = (1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , - 10 , 11 , 12 , 13 , 14 , - 15 , 16 )
116+ repr = exception .getrepr ()
117+ assert str (repr ).split ("\n " )[0 ] == "ValueError: Each value must be in 0..255"
118+
119+
120+ def test_create_instance_handle_from_tuple_with_large_number ():
121+ ih = fastdds .InstanceHandle_t ()
122+ with pytest .raises (SystemError ) as exception :
123+ ih .value = (1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 1000 , 11 , 12 , 13 , 14 , 15 , 16 )
124+ repr = exception .getrepr ()
125+ assert str (repr ).split ("\n " )[0 ] == "ValueError: Each value must be in 0..255"
126+
127+
128+ def test_create_instance_handle_from_list_with_negative_number ():
129+ ih = fastdds .InstanceHandle_t ()
130+ with pytest .raises (SystemError ) as exception :
131+ ih .value = [1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , - 10 , 11 , 12 , 13 , 14 , 15 , 16 ]
132+ repr = exception .getrepr ()
133+ assert str (repr ).split ("\n " )[0 ] == "ValueError: Each value must be in 0..255"
134+
135+
136+ def test_create_instance_handle_from_list_with_large_number ():
137+ ih = fastdds .InstanceHandle_t ()
138+ with pytest .raises (SystemError ) as exception :
139+ ih .value = [1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 1000 , 11 , 12 , 13 , 14 , 15 , 16 ]
140+ repr = exception .getrepr ()
141+ assert str (repr ).split ("\n " )[0 ] == "ValueError: Each value must be in 0..255"
0 commit comments