@@ -1041,15 +1041,7 @@ def test_read_pandas_w_nested_json_fails(session, write_engine):
1041
1041
session .read_pandas (pd_s , write_engine = write_engine )
1042
1042
1043
1043
1044
- @pytest .mark .parametrize (
1045
- ("write_engine" ),
1046
- [
1047
- pytest .param ("default" ),
1048
- pytest .param ("bigquery_inline" ),
1049
- pytest .param ("bigquery_streaming" ),
1050
- pytest .param ("bigquery_write" ),
1051
- ],
1052
- )
1044
+ @all_write_engines
1053
1045
def test_read_pandas_w_nested_json (session , write_engine ):
1054
1046
# TODO: supply a reason why this isn't compatible with pandas 1.x
1055
1047
pytest .importorskip ("pandas" , minversion = "2.0.0" )
@@ -1074,15 +1066,7 @@ def test_read_pandas_w_nested_json(session, write_engine):
1074
1066
pd .testing .assert_series_equal (bq_s , pd_s )
1075
1067
1076
1068
1077
- @pytest .mark .parametrize (
1078
- ("write_engine" ),
1079
- [
1080
- pytest .param ("default" ),
1081
- pytest .param ("bigquery_inline" ),
1082
- pytest .param ("bigquery_load" ),
1083
- pytest .param ("bigquery_streaming" ),
1084
- ],
1085
- )
1069
+ @all_write_engines
1086
1070
def test_read_pandas_w_nested_invalid_json (session , write_engine ):
1087
1071
# TODO: supply a reason why this isn't compatible with pandas 1.x
1088
1072
pytest .importorskip ("pandas" , minversion = "2.0.0" )
@@ -1127,15 +1111,7 @@ def test_read_pandas_w_nested_json_index_fails(session, write_engine):
1127
1111
session .read_pandas (pd_idx , write_engine = write_engine )
1128
1112
1129
1113
1130
- @pytest .mark .parametrize (
1131
- ("write_engine" ),
1132
- [
1133
- pytest .param ("default" ),
1134
- pytest .param ("bigquery_inline" ),
1135
- pytest .param ("bigquery_streaming" ),
1136
- pytest .param ("bigquery_write" ),
1137
- ],
1138
- )
1114
+ @all_write_engines
1139
1115
def test_read_pandas_w_nested_json_index (session , write_engine ):
1140
1116
# TODO: supply a reason why this isn't compatible with pandas 1.x
1141
1117
pytest .importorskip ("pandas" , minversion = "2.0.0" )
@@ -1287,6 +1263,32 @@ def test_read_csv_raises_error_for_invalid_index_col(
1287
1263
session .read_csv (path , engine = "bigquery" , index_col = index_col )
1288
1264
1289
1265
1266
+ def test_read_csv_for_gcs_wildcard_path (session , df_and_gcs_csv ):
1267
+ scalars_pandas_df , path = df_and_gcs_csv
1268
+ path = path .replace (".csv" , "*.csv" )
1269
+
1270
+ index_col = "rowindex"
1271
+ bf_df = session .read_csv (path , engine = "bigquery" , index_col = index_col )
1272
+
1273
+ # Convert default pandas dtypes to match BigQuery DataFrames dtypes.
1274
+ # Also, `expand=True` is needed to read from wildcard paths. See details:
1275
+ # https://github.com/fsspec/gcsfs/issues/616,
1276
+ if not pd .__version__ .startswith ("1." ):
1277
+ storage_options = {"expand" : True }
1278
+ else :
1279
+ storage_options = None
1280
+ pd_df = session .read_csv (
1281
+ path ,
1282
+ index_col = index_col ,
1283
+ dtype = scalars_pandas_df .dtypes .to_dict (),
1284
+ storage_options = storage_options ,
1285
+ )
1286
+
1287
+ assert bf_df .shape == pd_df .shape
1288
+ assert bf_df .columns .tolist () == pd_df .columns .tolist ()
1289
+ pd .testing .assert_frame_equal (bf_df .to_pandas (), pd_df .to_pandas ())
1290
+
1291
+
1290
1292
def test_read_csv_for_names (session , df_and_gcs_csv_for_two_columns ):
1291
1293
_ , path = df_and_gcs_csv_for_two_columns
1292
1294
0 commit comments