1919import pyarrow as pa
2020import pytest
2121
22- from tests .system . utils import assert_pandas_df_equal , convert_pandas_dtypes
22+ from tests .system import utils
2323
2424try :
2525 import pandas_gbq # type: ignore
@@ -115,7 +115,6 @@ def test_to_pandas_batches_w_correct_dtypes(scalars_df_default_index):
115115 pd .testing .assert_series_equal (actual , expected )
116116
117117
118- @pytest .mark .skip (reason = "Disable to unblock kokoro tests" )
119118@pytest .mark .parametrize (
120119 ("index" ),
121120 [True , False ],
@@ -150,12 +149,12 @@ def test_to_csv_index(
150149 # read_csv will decode into bytes inproperly, convert_pandas_dtypes will encode properly from string
151150 dtype .pop ("bytes_col" )
152151 gcs_df = pd .read_csv (
153- path ,
152+ utils . get_first_file_from_wildcard ( path ) ,
154153 dtype = dtype ,
155154 date_format = {"timestamp_col" : "YYYY-MM-DD HH:MM:SS Z" },
156155 index_col = index_col ,
157156 )
158- convert_pandas_dtypes (gcs_df , bytes_col = True )
157+ utils . convert_pandas_dtypes (gcs_df , bytes_col = True )
159158 gcs_df .index .name = scalars_df .index .name
160159
161160 scalars_pandas_df = scalars_pandas_df .copy ()
@@ -164,7 +163,6 @@ def test_to_csv_index(
164163 pd .testing .assert_frame_equal (gcs_df , scalars_pandas_df )
165164
166165
167- @pytest .mark .skip (reason = "Disable to unblock kokoro tests" )
168166def test_to_csv_tabs (
169167 scalars_dfs : Tuple [bigframes .dataframe .DataFrame , pd .DataFrame ],
170168 gcs_folder : str ,
@@ -189,13 +187,13 @@ def test_to_csv_tabs(
189187 # read_csv will decode into bytes inproperly, convert_pandas_dtypes will encode properly from string
190188 dtype .pop ("bytes_col" )
191189 gcs_df = pd .read_csv (
192- path ,
190+ utils . get_first_file_from_wildcard ( path ) ,
193191 sep = "\t " ,
194192 dtype = dtype ,
195193 date_format = {"timestamp_col" : "YYYY-MM-DD HH:MM:SS Z" },
196194 index_col = index_col ,
197195 )
198- convert_pandas_dtypes (gcs_df , bytes_col = True )
196+ utils . convert_pandas_dtypes (gcs_df , bytes_col = True )
199197 gcs_df .index .name = scalars_df .index .name
200198
201199 scalars_pandas_df = scalars_pandas_df .copy ()
@@ -229,7 +227,7 @@ def test_to_gbq_index(scalars_dfs, dataset_id, index):
229227 else :
230228 df_out = df_out .sort_values ("rowindex_2" ).reset_index (drop = True )
231229
232- convert_pandas_dtypes (df_out , bytes_col = False )
230+ utils . convert_pandas_dtypes (df_out , bytes_col = False )
233231 # pd.read_gbq interpets bytes_col as object, reconvert to pyarrow binary
234232 df_out ["bytes_col" ] = df_out ["bytes_col" ].astype (pd .ArrowDtype (pa .binary ()))
235233 expected = scalars_pandas_df .copy ()
@@ -415,7 +413,6 @@ def test_to_json_index_invalid_lines(
415413 scalars_df .to_json (path , index = index )
416414
417415
418- @pytest .mark .skip (reason = "Disable to unblock kokoro tests" )
419416@pytest .mark .parametrize (
420417 ("index" ),
421418 [True , False ],
@@ -435,8 +432,12 @@ def test_to_json_index_records_orient(
435432 """ Test the `to_json` API with `orient` is `records` and `lines` is True"""
436433 scalars_df .to_json (path , index = index , orient = "records" , lines = True )
437434
438- gcs_df = pd .read_json (path , lines = True , convert_dates = ["datetime_col" ])
439- convert_pandas_dtypes (gcs_df , bytes_col = True )
435+ gcs_df = pd .read_json (
436+ utils .get_first_file_from_wildcard (path ),
437+ lines = True ,
438+ convert_dates = ["datetime_col" ],
439+ )
440+ utils .convert_pandas_dtypes (gcs_df , bytes_col = True )
440441 if index and scalars_df .index .name is not None :
441442 gcs_df = gcs_df .set_index (scalars_df .index .name )
442443
@@ -474,8 +475,8 @@ def test_to_parquet_index(scalars_dfs, gcs_folder, index):
474475 # table.
475476 scalars_df .to_parquet (path , index = index )
476477
477- gcs_df = pd .read_parquet (path . replace ( "*" , "000000000000" ))
478- convert_pandas_dtypes (gcs_df , bytes_col = False )
478+ gcs_df = pd .read_parquet (utils . get_first_file_from_wildcard ( path ))
479+ utils . convert_pandas_dtypes (gcs_df , bytes_col = False )
479480 if index and scalars_df .index .name is not None :
480481 gcs_df = gcs_df .set_index (scalars_df .index .name )
481482
@@ -507,7 +508,7 @@ def test_to_sql_query_unnamed_index_included(
507508 pd_df = scalars_pandas_df_default_index .reset_index (drop = True )
508509 roundtrip = session .read_gbq (sql , index_col = idx_ids )
509510 roundtrip .index .names = [None ]
510- assert_pandas_df_equal (roundtrip .to_pandas (), pd_df , check_index_type = False )
511+ utils . assert_pandas_df_equal (roundtrip .to_pandas (), pd_df , check_index_type = False )
511512
512513
513514def test_to_sql_query_named_index_included (
@@ -524,7 +525,7 @@ def test_to_sql_query_named_index_included(
524525
525526 pd_df = scalars_pandas_df_default_index .set_index ("rowindex_2" , drop = True )
526527 roundtrip = session .read_gbq (sql , index_col = idx_ids )
527- assert_pandas_df_equal (roundtrip .to_pandas (), pd_df )
528+ utils . assert_pandas_df_equal (roundtrip .to_pandas (), pd_df )
528529
529530
530531def test_to_sql_query_unnamed_index_excluded (
@@ -539,7 +540,7 @@ def test_to_sql_query_unnamed_index_excluded(
539540
540541 pd_df = scalars_pandas_df_default_index .reset_index (drop = True )
541542 roundtrip = session .read_gbq (sql )
542- assert_pandas_df_equal (
543+ utils . assert_pandas_df_equal (
543544 roundtrip .to_pandas (), pd_df , check_index_type = False , ignore_order = True
544545 )
545546
@@ -558,6 +559,6 @@ def test_to_sql_query_named_index_excluded(
558559 "rowindex_2" , drop = True
559560 ).reset_index (drop = True )
560561 roundtrip = session .read_gbq (sql )
561- assert_pandas_df_equal (
562+ utils . assert_pandas_df_equal (
562563 roundtrip .to_pandas (), pd_df , check_index_type = False , ignore_order = True
563564 )
0 commit comments