@@ -1041,15 +1041,7 @@ def test_read_pandas_w_nested_json_fails(session, write_engine):
10411041 session .read_pandas (pd_s , write_engine = write_engine )
10421042
10431043
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
10531045def test_read_pandas_w_nested_json (session , write_engine ):
10541046 # TODO: supply a reason why this isn't compatible with pandas 1.x
10551047 pytest .importorskip ("pandas" , minversion = "2.0.0" )
@@ -1074,15 +1066,7 @@ def test_read_pandas_w_nested_json(session, write_engine):
10741066 pd .testing .assert_series_equal (bq_s , pd_s )
10751067
10761068
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
10861070def test_read_pandas_w_nested_invalid_json (session , write_engine ):
10871071 # TODO: supply a reason why this isn't compatible with pandas 1.x
10881072 pytest .importorskip ("pandas" , minversion = "2.0.0" )
@@ -1127,15 +1111,7 @@ def test_read_pandas_w_nested_json_index_fails(session, write_engine):
11271111 session .read_pandas (pd_idx , write_engine = write_engine )
11281112
11291113
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
11391115def test_read_pandas_w_nested_json_index (session , write_engine ):
11401116 # TODO: supply a reason why this isn't compatible with pandas 1.x
11411117 pytest .importorskip ("pandas" , minversion = "2.0.0" )
@@ -1287,6 +1263,32 @@ def test_read_csv_raises_error_for_invalid_index_col(
12871263 session .read_csv (path , engine = "bigquery" , index_col = index_col )
12881264
12891265
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+
12901292def test_read_csv_for_names (session , df_and_gcs_csv_for_two_columns ):
12911293 _ , path = df_and_gcs_csv_for_two_columns
12921294
0 commit comments