@@ -825,9 +825,10 @@ def test_numeric_string_parsing(self, input_str, byte_order):
825825 ("+INFINITY" , 1 ),
826826 ("-INFINITY" , - 1 ),
827827 ])
828- def test_infinity_sign_preservation (self , input_str , expected_sign ):
828+ @pytest .mark .parametrize ("strtype" , ['U20' , np .dtypes .StringDType ()])
829+ def test_infinity_sign_preservation (self , input_str , expected_sign , strtype ):
829830 """Test that +/- signs are correctly applied to infinity values"""
830- arr = np .array ([input_str ], dtype = 'U20' )
831+ arr = np .array ([input_str ], dtype = strtype )
831832 result = arr .astype (QuadPrecDType ())
832833
833834 assert np .isinf (float (str (result [0 ]))), f"Expected inf for '{ input_str } '"
@@ -842,9 +843,10 @@ def test_infinity_sign_preservation(self, input_str, expected_sign):
842843 "NAN" , "+NAN" , "-NAN" ,
843844 "nan()" , "nan(123)" , "nan(abc_)" , "NAN(XYZ)" ,
844845 ])
845- def test_nan_case_insensitive (self , input_str ):
846+ @pytest .mark .parametrize ("strtype" , ['U20' , np .dtypes .StringDType ()])
847+ def test_nan_case_insensitive (self , input_str , strtype ):
846848 """Test case-insensitive NaN parsing with optional payloads"""
847- arr = np .array ([input_str ], dtype = 'U20' )
849+ arr = np .array ([input_str ], dtype = strtype )
848850 result = arr .astype (QuadPrecDType ())
849851
850852 assert np .isnan (float (str (result [0 ]))), f"Expected NaN for '{ input_str } '"
@@ -890,9 +892,10 @@ def test_numeric_sign_handling(self, input_str, expected_val):
890892 "\t -inf\t " ,
891893 " nan " ,
892894 ])
893- def test_whitespace_handling (self , input_str ):
895+ @pytest .mark .parametrize ("strtype" , ['U20' , np .dtypes .StringDType ()])
896+ def test_whitespace_handling (self , input_str , strtype ):
894897 """Test that leading/trailing whitespace is handled correctly"""
895- arr = np .array ([input_str ], dtype = 'U20' )
898+ arr = np .array ([input_str ], dtype = strtype )
896899 result = arr .astype (QuadPrecDType ())
897900
898901 # Should not raise an error
@@ -912,9 +915,10 @@ def test_whitespace_handling(self, input_str):
912915 "na" , # Incomplete nan
913916 "infinit" , # Incomplete infinity
914917 ])
915- def test_invalid_strings_raise_error (self , invalid_str ):
918+ @pytest .mark .parametrize ("strtype" , ['U20' , np .dtypes .StringDType ()])
919+ def test_invalid_strings_raise_error (self , invalid_str , strtype ):
916920 """Test that invalid strings raise ValueError"""
917- arr = np .array ([invalid_str ], dtype = 'U20' )
921+ arr = np .array ([invalid_str ], dtype = strtype )
918922
919923 with pytest .raises (ValueError ):
920924 arr .astype (QuadPrecDType ())
@@ -925,9 +929,10 @@ def test_invalid_strings_raise_error(self, invalid_str):
925929 "3.1€4" , # Mid non-ASCII
926930 "π" , # Greek pi
927931 ])
928- def test_non_ascii_raises_error (self , input_str ):
932+ @pytest .mark .parametrize ("strtype" , ['U20' , np .dtypes .StringDType ()])
933+ def test_non_ascii_raises_error (self , input_str , strtype ):
929934 """Test that non-ASCII characters raise ValueError"""
930- arr = np .array ([input_str ], dtype = 'U20' )
935+ arr = np .array ([input_str ], dtype = strtype )
931936
932937 with pytest .raises (ValueError ):
933938 arr .astype (QuadPrecDType ())
0 commit comments