@@ -53,17 +53,30 @@ def test_virtualfile_from_vectors(dtypes):
5353
5454
5555@pytest .mark .benchmark
56- @pytest .mark .parametrize ("dtype" , [str , object ])
57- def test_virtualfile_from_vectors_one_string_or_object_column (dtype ):
58- """
59- Test passing in one column with string or object dtype into virtual file dataset.
56+ @pytest .mark .parametrize (
57+ ("array_func" , "dtype" ),
58+ [
59+ pytest .param (np .array , {"dtype" : np .str_ }, id = "str" ),
60+ pytest .param (np .array , {"dtype" : np .object_ }, id = "object" ),
61+ pytest .param (
62+ getattr (pa , "array" , None ),
63+ {}, # pa.string()
64+ marks = skip_if_no (package = "pyarrow" ),
65+ id = "pyarrow" ,
66+ ),
67+ ],
68+ )
69+ def test_virtualfile_from_vectors_one_string_or_object_column (array_func , dtype ):
70+ """
71+ Test passing in one column with string (numpy/pyarrow) or object (numpy)
72+ dtype into virtual file dataset.
6073 """
6174 size = 5
6275 x = np .arange (size , dtype = np .int32 )
6376 y = np .arange (size , size * 2 , 1 , dtype = np .int32 )
64- strings = np . array (["a" , "bc" , "defg" , "hijklmn" , "opqrst" ], dtype = dtype )
77+ strings = array_func (["a" , "bc" , "defg" , "hijklmn" , "opqrst" ], ** dtype )
6578 with clib .Session () as lib :
66- with lib .virtualfile_from_vectors (( x , y , strings ) ) as vfile :
79+ with lib .virtualfile_from_vectors (x , y , strings ) as vfile :
6780 with GMTTempFile () as outfile :
6881 lib .call_module ("convert" , [vfile , f"->{ outfile .name } " ])
6982 output = outfile .read (keep_tabs = True )
0 commit comments