@@ -182,7 +182,7 @@ def test_numpy_array_d3_f64(self):
182182 b"[[[1.0,2.0],[3.0,4.0]],[[5.0,6.0],[7.0,8.0]]]" ,
183183 )
184184
185- def test_numpy_array_fotran (self ):
185+ def test_numpy_array_fortran (self ):
186186 array = numpy .array ([[1 , 2 ], [3 , 4 ]], order = "F" )
187187 assert array .flags ["F_CONTIGUOUS" ] == True
188188 with self .assertRaises (orjson .JSONEncodeError ):
@@ -194,6 +194,18 @@ def test_numpy_array_fotran(self):
194194 orjson .dumps (array .tolist ()),
195195 )
196196
197+ def test_numpy_array_non_contiguous_message (self ):
198+ array = numpy .array ([[1 , 2 ], [3 , 4 ]], order = "F" )
199+ assert array .flags ["F_CONTIGUOUS" ] == True
200+ try :
201+ orjson .dumps (array , option = orjson .OPT_SERIALIZE_NUMPY )
202+ assert False
203+ except TypeError as exc :
204+ self .assertEqual (
205+ str (exc ),
206+ "numpy array is not C contiguous; use ndarray.tolist() in default" ,
207+ )
208+
197209 def test_numpy_array_unsupported_dtype (self ):
198210 array = numpy .array ([[1 , 2 ], [3 , 4 ]], numpy .float16 )
199211 with self .assertRaises (orjson .JSONEncodeError ):
0 commit comments