@@ -67,7 +67,7 @@ def bq_cf_connection_location_project(bigquery_client) -> str:
6767
6868@pytest .fixture (scope = "module" )
6969def bq_cf_connection_location_project_mismatched () -> str :
70- """Pre-created BQ connection in the migframes -metrics project in US location,
70+ """Pre-created BQ connection in the bigframes -metrics project in US location,
7171 in format PROJECT_ID.LOCATION.CONNECTION_NAME, used to invoke cloud function.
7272
7373 $ bq show --connection --location=us --project_id=PROJECT_ID bigframes-rf-conn
@@ -108,11 +108,15 @@ def test_remote_function_direct_no_session_param(
108108 reuse = True ,
109109 )
110110 def square (x ):
111- # This executes on a remote function, where coverage isn't tracked.
112- return x * x # pragma: NO COVER
111+ return x * x
113112
114- assert square .bigframes_remote_function
115- assert square .bigframes_cloud_function
113+ # Function should still work normally.
114+ assert square (2 ) == 4
115+
116+ # Function should have extra metadata attached for remote execution.
117+ assert hasattr (square , "bigframes_remote_function" )
118+ assert hasattr (square , "bigframes_cloud_function" )
119+ assert hasattr (square , "ibis_node" )
116120
117121 scalars_df , scalars_pandas_df = scalars_dfs
118122
@@ -161,8 +165,10 @@ def test_remote_function_direct_no_session_param_location_specified(
161165 reuse = True ,
162166 )
163167 def square (x ):
164- # This executes on a remote function, where coverage isn't tracked.
165- return x * x # pragma: NO COVER
168+ return x * x
169+
170+ # Function should still work normally.
171+ assert square (2 ) == 4
166172
167173 scalars_df , scalars_pandas_df = scalars_dfs
168174
@@ -197,7 +203,10 @@ def test_remote_function_direct_no_session_param_location_mismatched(
197203 dataset_id_permanent ,
198204 bq_cf_connection_location_mismatched ,
199205):
200- with pytest .raises (ValueError ):
206+ with pytest .raises (
207+ ValueError ,
208+ match = re .escape ("The location does not match BigQuery connection location:" ),
209+ ):
201210
202211 @rf .remote_function (
203212 [int ],
@@ -212,7 +221,8 @@ def test_remote_function_direct_no_session_param_location_mismatched(
212221 reuse = True ,
213222 )
214223 def square (x ):
215- # This executes on a remote function, where coverage isn't tracked.
224+ # Not expected to reach this code, as the location of the
225+ # connection doesn't match the location of the dataset.
216226 return x * x # pragma: NO COVER
217227
218228
@@ -239,8 +249,10 @@ def test_remote_function_direct_no_session_param_location_project_specified(
239249 reuse = True ,
240250 )
241251 def square (x ):
242- # This executes on a remote function, where coverage isn't tracked.
243- return x * x # pragma: NO COVER
252+ return x * x
253+
254+ # Function should still work normally.
255+ assert square (2 ) == 4
244256
245257 scalars_df , scalars_pandas_df = scalars_dfs
246258
@@ -275,7 +287,12 @@ def test_remote_function_direct_no_session_param_project_mismatched(
275287 dataset_id_permanent ,
276288 bq_cf_connection_location_project_mismatched ,
277289):
278- with pytest .raises (ValueError ):
290+ with pytest .raises (
291+ ValueError ,
292+ match = re .escape (
293+ "The project_id does not match BigQuery connection gcp_project_id:"
294+ ),
295+ ):
279296
280297 @rf .remote_function (
281298 [int ],
@@ -290,7 +307,8 @@ def test_remote_function_direct_no_session_param_project_mismatched(
290307 reuse = True ,
291308 )
292309 def square (x ):
293- # This executes on a remote function, where coverage isn't tracked.
310+ # Not expected to reach this code, as the project of the
311+ # connection doesn't match the project of the dataset.
294312 return x * x # pragma: NO COVER
295313
296314
@@ -302,8 +320,10 @@ def test_remote_function_direct_session_param(session_with_bq_connection, scalar
302320 session = session_with_bq_connection ,
303321 )
304322 def square (x ):
305- # This executes on a remote function, where coverage isn't tracked.
306- return x * x # pragma: NO COVER
323+ return x * x
324+
325+ # Function should still work normally.
326+ assert square (2 ) == 4
307327
308328 scalars_df , scalars_pandas_df = scalars_dfs
309329
@@ -340,8 +360,10 @@ def test_remote_function_via_session_default(session_with_bq_connection, scalars
340360 # cloud function would be common and quickly reused.
341361 @session_with_bq_connection .remote_function ([int ], int )
342362 def square (x ):
343- # This executes on a remote function, where coverage isn't tracked.
344- return x * x # pragma: NO COVER
363+ return x * x
364+
365+ # Function should still work normally.
366+ assert square (2 ) == 4
345367
346368 scalars_df , scalars_pandas_df = scalars_dfs
347369
@@ -380,8 +402,10 @@ def test_remote_function_via_session_with_overrides(
380402 reuse = True ,
381403 )
382404 def square (x ):
383- # This executes on a remote function, where coverage isn't tracked.
384- return x * x # pragma: NO COVER
405+ return x * x
406+
407+ # Function should still work normally.
408+ assert square (2 ) == 4
385409
386410 scalars_df , scalars_pandas_df = scalars_dfs
387411
@@ -508,7 +532,7 @@ def test_skip_bq_connection_check(dataset_id_permanent):
508532
509533 @session .remote_function ([int ], int , dataset = dataset_id_permanent )
510534 def add_one (x ):
511- # This executes on a remote function, where coverage isn 't tracked .
535+ # Not expected to reach this code, as the connection doesn 't exist .
512536 return x + 1 # pragma: NO COVER
513537
514538
@@ -546,8 +570,10 @@ def test_read_gbq_function_like_original(
546570 reuse = True ,
547571 )
548572 def square1 (x ):
549- # This executes on a remote function, where coverage isn't tracked.
550- return x * x # pragma: NO COVER
573+ return x * x
574+
575+ # Function should still work normally.
576+ assert square1 (2 ) == 4
551577
552578 square2 = rf .read_gbq_function (
553579 function_name = square1 .bigframes_remote_function ,
0 commit comments