30
30
import bigframes .dataframe
31
31
import bigframes .dtypes
32
32
import bigframes .ml .linear_model
33
- from tests .system .utils import skip_legacy_pandas
34
-
35
- FIRST_FILE = "000000000000"
33
+ from tests .system .utils import FIRST_GCS_FILE_SUFFIX , skip_legacy_pandas
36
34
37
35
38
36
def test_read_gbq_tokyo (
@@ -442,7 +440,7 @@ def test_read_csv_gcs_default_engine(session, scalars_dfs, gcs_folder):
442
440
path = gcs_folder + "test_read_csv_gcs_default_engine_w_index*.csv"
443
441
else :
444
442
path = gcs_folder + "test_read_csv_gcs_default_engine_wo_index*.csv"
445
- read_path = path .replace ("*" , FIRST_FILE )
443
+ read_path = path .replace ("*" , FIRST_GCS_FILE_SUFFIX )
446
444
scalars_df .to_csv (path , index = False )
447
445
dtype = scalars_df .dtypes .to_dict ()
448
446
dtype .pop ("geography_col" )
@@ -641,15 +639,15 @@ def test_read_csv_default_engine_throws_not_implemented_error(
641
639
gcs_folder
642
640
+ "test_read_csv_gcs_default_engine_throws_not_implemented_error*.csv"
643
641
)
644
- read_path = path .replace ("*" , FIRST_FILE )
642
+ read_path = path .replace ("*" , FIRST_GCS_FILE_SUFFIX )
645
643
scalars_df_index .to_csv (path )
646
644
with pytest .raises (NotImplementedError , match = match ):
647
645
session .read_csv (read_path , ** kwargs )
648
646
649
647
650
648
def test_read_csv_gcs_default_engine_w_header (session , scalars_df_index , gcs_folder ):
651
649
path = gcs_folder + "test_read_csv_gcs_default_engine_w_header*.csv"
652
- read_path = path .replace ("*" , FIRST_FILE )
650
+ read_path = path .replace ("*" , FIRST_GCS_FILE_SUFFIX )
653
651
scalars_df_index .to_csv (path )
654
652
655
653
# Skips header=N rows, normally considers the N+1th row as the header, but overridden by
@@ -716,7 +714,7 @@ def test_read_csv_gcs_default_engine_w_index_col_name(
716
714
session , scalars_df_default_index , gcs_folder
717
715
):
718
716
path = gcs_folder + "test_read_csv_gcs_default_engine_w_index_col_name*.csv"
719
- read_path = path .replace ("*" , FIRST_FILE )
717
+ read_path = path .replace ("*" , FIRST_GCS_FILE_SUFFIX )
720
718
scalars_df_default_index .to_csv (path )
721
719
722
720
df = session .read_csv (read_path , index_col = "rowindex" )
@@ -731,7 +729,7 @@ def test_read_csv_gcs_default_engine_w_index_col_index(
731
729
session , scalars_df_default_index , gcs_folder
732
730
):
733
731
path = gcs_folder + "test_read_csv_gcs_default_engine_w_index_col_index*.csv"
734
- read_path = path .replace ("*" , FIRST_FILE )
732
+ read_path = path .replace ("*" , FIRST_GCS_FILE_SUFFIX )
735
733
scalars_df_default_index .to_csv (path )
736
734
737
735
index_col = scalars_df_default_index .columns .to_list ().index ("rowindex" )
@@ -790,7 +788,7 @@ def test_read_csv_local_default_engine_w_index_col_index(
790
788
def test_read_csv_gcs_w_usecols (session , scalars_df_index , gcs_folder , engine ):
791
789
path = gcs_folder + "test_read_csv_gcs_w_usecols"
792
790
path = path + "_default_engine*.csv" if engine is None else path + "_bq_engine*.csv"
793
- read_path = path .replace ("*" , FIRST_FILE ) if engine is None else path
791
+ read_path = path .replace ("*" , FIRST_GCS_FILE_SUFFIX ) if engine is None else path
794
792
scalars_df_index .to_csv (path )
795
793
796
794
# df should only have 1 column which is bool_col.
@@ -902,7 +900,7 @@ def test_read_parquet_gcs(session: bigframes.Session, scalars_dfs, gcs_folder, e
902
900
903
901
# Only bigquery engine for reads supports wildcards in path name.
904
902
if engine != "bigquery" :
905
- path = path .replace ("*" , "000000000000" )
903
+ path = path .replace ("*" , FIRST_GCS_FILE_SUFFIX )
906
904
907
905
df_out = (
908
906
session .read_parquet (path , engine = engine )
@@ -1012,7 +1010,7 @@ def test_read_parquet_gcs_compression_not_supported(
1012
1010
def test_read_json_gcs_bq_engine (session , scalars_dfs , gcs_folder ):
1013
1011
scalars_df , _ = scalars_dfs
1014
1012
path = gcs_folder + "test_read_json_gcs_bq_engine_w_index*.json"
1015
- read_path = path .replace ("*" , FIRST_FILE )
1013
+ read_path = path .replace ("*" , FIRST_GCS_FILE_SUFFIX )
1016
1014
scalars_df .to_json (path , index = False , lines = True , orient = "records" )
1017
1015
df = session .read_json (read_path , lines = True , orient = "records" , engine = "bigquery" )
1018
1016
@@ -1036,7 +1034,7 @@ def test_read_json_gcs_bq_engine(session, scalars_dfs, gcs_folder):
1036
1034
def test_read_json_gcs_default_engine (session , scalars_dfs , gcs_folder ):
1037
1035
scalars_df , _ = scalars_dfs
1038
1036
path = gcs_folder + "test_read_json_gcs_default_engine_w_index*.json"
1039
- read_path = path .replace ("*" , FIRST_FILE )
1037
+ read_path = path .replace ("*" , FIRST_GCS_FILE_SUFFIX )
1040
1038
scalars_df .to_json (
1041
1039
path ,
1042
1040
index = False ,
0 commit comments