@@ -746,19 +746,6 @@ def test_empty_bytes_raises_error(self):
746746 with pytest .raises (ValueError ):
747747 bytes_array .astype (QuadPrecDType ())
748748
749- @pytest .mark .parametrize ('dtype' , ['S50' , 'U50' ])
750- @pytest .mark .parametrize ('size' , [500 , 1000 , 10000 ])
751- def test_large_array_casting (self , dtype , size ):
752- """Test long array casting won't lead segfault, GIL enabled"""
753- arr = np .arange (size ).astype (np .float32 ).astype (dtype )
754- quad_arr = arr .astype (QuadPrecDType ())
755- assert quad_arr .dtype == QuadPrecDType ()
756- assert quad_arr .size == size
757-
758- # check roundtrip
759- roundtrip = quad_arr .astype (dtype )
760- np .testing .assert_array_equal (arr , roundtrip )
761-
762749class TestStringParsingEdgeCases :
763750 """Test edge cases in NumPyOS_ascii_strtoq string parsing"""
764751 @pytest .mark .parametrize ("input_str" , ['3.14' , '-2.71' , '0.0' , '1e10' , '-1e-10' ])
@@ -5117,4 +5104,31 @@ def test_pickle_fortran_order(self, backend):
51175104 # Verify array is preserved
51185105 np .testing .assert_array_equal (unpickled , original )
51195106 assert unpickled .dtype == original .dtype
5120- assert unpickled .flags .f_contiguous == original .flags .f_contiguous
5107+ assert unpickled .flags .f_contiguous == original .flags .f_contiguous
5108+
5109+ @pytest .mark .parametrize ("dtype" , [
5110+ "bool" ,
5111+ "byte" , "int8" , "ubyte" , "uint8" ,
5112+ "short" , "int16" , "ushort" , "uint16" ,
5113+ "int" , "int32" , "uint" , "uint32" ,
5114+ "long" , "ulong" ,
5115+ "longlong" , "int64" , "ulonglong" , "uint64" ,
5116+ "half" , "float16" ,
5117+ "float" , "float32" ,
5118+ "double" , "float64" ,
5119+ "longdouble" , "float96" , "float128" ,
5120+ "S50" , "U50" , "<U50" , ">U50" ,
5121+ ])
5122+ @pytest .mark .parametrize ('size' , [500 , 1000 , 10000 ])
5123+ def test_large_array_casting (dtype , size ):
5124+ """Test long array casting won't lead segfault, GIL enabled"""
5125+ if dtype in ("float96" , "float128" ) and getattr (np , dtype , None ) is None :
5126+ pytest .skip (f"{ dtype } is unsupported on the current platform" )
5127+ arr = np .arange (size ).astype (np .float32 ).astype (dtype )
5128+ quad_arr = arr .astype (QuadPrecDType ())
5129+ assert quad_arr .dtype == QuadPrecDType ()
5130+ assert quad_arr .size == size
5131+
5132+ # check roundtrip
5133+ roundtrip = quad_arr .astype (dtype )
5134+ np .testing .assert_array_equal (arr , roundtrip )
0 commit comments