@@ -836,8 +836,15 @@ def test_typed_array():
836
836
837
837
with pytest .raises (TypeError ):
838
838
ob = Test .TypedArrayTest ()
839
- ob .items ["wrong" ] = "wrong"
839
+ ob .items ["wrong" ] = Spam ("0" )
840
+
841
+ with pytest .raises (TypeError ):
842
+ ob = Test .TypedArrayTest ()
843
+ _ = ob .items [0.5 ]
840
844
845
+ with pytest .raises (TypeError ):
846
+ ob = Test .TypedArrayTest ()
847
+ ob .items [0.5 ] = Spam ("0" )
841
848
842
849
def test_multi_dimensional_array ():
843
850
"""Test multi-dimensional arrays."""
@@ -901,8 +908,23 @@ def test_multi_dimensional_array():
901
908
902
909
with pytest .raises (TypeError ):
903
910
ob = Test .MultiDimensionalArrayTest ()
904
- ob [0 , 0 ] = "wrong"
911
+ ob . items [0 , 0 ] = "wrong"
905
912
913
+ with pytest .raises (TypeError ):
914
+ ob = Test .MultiDimensionalArrayTest ()
915
+ ob ["0" , 0 ] = 0
916
+
917
+ with pytest .raises (TypeError ):
918
+ ob = Test .MultiDimensionalArrayTest ()
919
+ ob .items ["0" , 0 ] = 0
920
+
921
+ with pytest .raises (TypeError ):
922
+ ob = Test .MultiDimensionalArrayTest ()
923
+ _ = ob .items [0.5 , 0 ]
924
+
925
+ with pytest .raises (TypeError ):
926
+ ob = Test .MultiDimensionalArrayTest ()
927
+ ob .items [0.5 , 0 ] = 0
906
928
907
929
def test_array_iteration ():
908
930
"""Test array iteration."""
@@ -1189,6 +1211,15 @@ def test_create_array_from_shape():
1189
1211
with pytest .raises (ValueError ):
1190
1212
Array [int ](- 1 )
1191
1213
1214
+ with pytest .raises (TypeError ):
1215
+ Array [int ]('1' )
1216
+
1217
+ with pytest .raises (ValueError ):
1218
+ Array [int ](- 1 , - 1 )
1219
+
1220
+ with pytest .raises (TypeError ):
1221
+ Array [int ]('1' , '1' )
1222
+
1192
1223
def test_special_array_creation ():
1193
1224
"""Test using the Array[<type>] syntax for creating arrays."""
1194
1225
from Python .Test import ISayHello1 , InterfaceTest , ShortEnum
0 commit comments