@@ -1958,20 +1958,33 @@ def the_sum(s1, s2, x):
19581958
19591959 # Fails to apply on dataframe with incompatible number of columns.
19601960 with pytest .raises (
1961- ValueError ,
1962- match = "^Column count mismatch: BigFrames BigQuery function expected 2 columns from DataFrame but received 3\\ .$" ,
1961+ ValueError , match = "^Parameter count mismatch:.* expected 3 but received 4."
19631962 ):
1964- scalars_df [columns + ["float64_col" ]].apply (the_sum_mf , axis = 1 , args = args1 )
1963+ scalars_df [columns ].apply (
1964+ the_sum_mf ,
1965+ axis = 1 ,
1966+ args = (
1967+ 1 ,
1968+ 1 ,
1969+ ),
1970+ )
19651971
19661972 # Fails to apply on dataframe with incompatible column datatypes.
19671973 with pytest .raises (
19681974 ValueError ,
1969- match = "^Data type mismatch: BigFrames BigQuery function takes arguments of types .* but DataFrame dtypes are .*" ,
1975+ match = "^Data type mismatch for DataFrame columns: Expected .* Received .*" ,
19701976 ):
19711977 scalars_df [columns ].assign (
19721978 int64_col = lambda df : df ["int64_col" ].astype ("Float64" )
19731979 ).apply (the_sum_mf , axis = 1 , args = args1 )
19741980
1981+ # Fails to apply on dataframe with incompatible args datatypes.
1982+ with pytest .raises (
1983+ ValueError ,
1984+ match = "^Data type mismatch for 'args' parameter: Expected .* Received .*" ,
1985+ ):
1986+ scalars_df [columns ].apply (the_sum_mf , axis = 1 , args = ("hello world" ,))
1987+
19751988 bf_result = (
19761989 scalars_df [columns ]
19771990 .dropna ()
@@ -2293,20 +2306,18 @@ def foo(x, y, z):
22932306
22942307 # Fails to apply on dataframe with incompatible number of columns
22952308 with pytest .raises (
2296- ValueError ,
2297- match = "^Column count mismatch: BigFrames BigQuery function expected 3 columns from DataFrame but received 2\\ .$" ,
2309+ ValueError , match = "^Parameter count mismatch:.* expected 3 but received 2."
22982310 ):
22992311 bf_df [["Id" , "Age" ]].apply (foo , axis = 1 )
23002312 with pytest .raises (
2301- ValueError ,
2302- match = "^Column count mismatch: BigFrames BigQuery function expected 3 columns from DataFrame but received 4\\ .$" ,
2313+ ValueError , match = "^Parameter count mismatch:.* expected 3 but received 4."
23032314 ):
23042315 bf_df .assign (Country = "lalaland" ).apply (foo , axis = 1 )
23052316
23062317 # Fails to apply on dataframe with incompatible column datatypes
23072318 with pytest .raises (
23082319 ValueError ,
2309- match = "^Data type mismatch: BigFrames BigQuery function takes arguments of types .* but DataFrame dtypes are .*" ,
2320+ match = "^Data type mismatch for DataFrame columns: Expected .* Received .*" ,
23102321 ):
23112322 bf_df .assign (Age = bf_df ["Age" ].astype ("Int64" )).apply (foo , axis = 1 )
23122323
@@ -2377,20 +2388,18 @@ def foo(x, y, z):
23772388
23782389 # Fails to apply on dataframe with incompatible number of columns
23792390 with pytest .raises (
2380- ValueError ,
2381- match = "^Column count mismatch: BigFrames BigQuery function expected 3 columns from DataFrame but received 2\\ .$" ,
2391+ ValueError , match = "^Parameter count mismatch:.* expected 3 but received 2."
23822392 ):
23832393 bf_df [["Id" , "Age" ]].apply (foo , axis = 1 )
23842394 with pytest .raises (
2385- ValueError ,
2386- match = "^Column count mismatch: BigFrames BigQuery function expected 3 columns from DataFrame but received 4\\ .$" ,
2395+ ValueError , match = "^Parameter count mismatch:.* expected 3 but received 4."
23872396 ):
23882397 bf_df .assign (Country = "lalaland" ).apply (foo , axis = 1 )
23892398
23902399 # Fails to apply on dataframe with incompatible column datatypes
23912400 with pytest .raises (
23922401 ValueError ,
2393- match = "^Data type mismatch: BigFrames BigQuery function takes arguments of types .* but DataFrame dtypes are .*" ,
2402+ match = "^Data type mismatch for DataFrame columns: Expected .* Received .*" ,
23942403 ):
23952404 bf_df .assign (Age = bf_df ["Age" ].astype ("Int64" )).apply (foo , axis = 1 )
23962405
@@ -2451,20 +2460,18 @@ def foo(x):
24512460
24522461 # Fails to apply on dataframe with incompatible number of columns
24532462 with pytest .raises (
2454- ValueError ,
2455- match = "^Column count mismatch: BigFrames BigQuery function expected 1 columns from DataFrame but received 0\\ .$" ,
2463+ ValueError , match = "^Parameter count mismatch:.* expected 1 but received 0."
24562464 ):
24572465 bf_df [[]].apply (foo , axis = 1 )
24582466 with pytest .raises (
2459- ValueError ,
2460- match = "^Column count mismatch: BigFrames BigQuery function expected 1 columns from DataFrame but received 2\\ .$" ,
2467+ ValueError , match = "^Parameter count mismatch:.* expected 1 but received 2."
24612468 ):
24622469 bf_df .assign (Country = "lalaland" ).apply (foo , axis = 1 )
24632470
24642471 # Fails to apply on dataframe with incompatible column datatypes
24652472 with pytest .raises (
24662473 ValueError ,
2467- match = "^Data type mismatch: BigFrames BigQuery function takes arguments of types .* but DataFrame dtypes are .*" ,
2474+ match = "^Data type mismatch for DataFrame columns: Expected .* Received .*" ,
24682475 ):
24692476 bf_df .assign (Id = bf_df ["Id" ].astype ("Float64" )).apply (foo , axis = 1 )
24702477
0 commit comments