@@ -53,17 +53,30 @@ def test_virtualfile_from_vectors(dtypes):
53
53
54
54
55
55
@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.
60
73
"""
61
74
size = 5
62
75
x = np .arange (size , dtype = np .int32 )
63
76
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 )
65
78
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 :
67
80
with GMTTempFile () as outfile :
68
81
lib .call_module ("convert" , [vfile , f"->{ outfile .name } " ])
69
82
output = outfile .read (keep_tabs = True )
0 commit comments