File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change 1414
1515"""Unit tests for read_gbq_colab helper functions."""
1616
17+ import itertools
1718import textwrap
1819from unittest import mock
1920
2728
2829def test_read_gbq_colab_includes_label ():
2930 """Make sure we can tell direct colab usage apart from regular read_gbq usage."""
30- session = mocks .create_bigquery_session ()
31+ bqclient = mock .create_autospec (bigquery .Client , instance = True )
32+ bqclient .project = "proj"
33+ session = mocks .create_bigquery_session (bqclient = bqclient )
3134 _ = session ._read_gbq_colab ("SELECT 'read-gbq-colab-test'" )
32- configs = session ._job_configs # type: ignore
3335
3436 label_values = []
35- for config in configs :
36- if config is None :
37+ for kall in itertools .chain (
38+ bqclient .query_and_wait .call_args_list ,
39+ bqclient ._query_and_wait_bigframes .call_args_list ,
40+ bqclient .query .call_args_list ,
41+ ):
42+ breakpoint ()
43+ job_config = kall .kwargs .get ("job_config" )
44+ if job_config is None :
3745 continue
38- label_values .extend (config .labels .values ())
46+ label_values .extend (job_config .labels .values ())
3947
4048 assert "session-read_gbq_colab" in label_values
4149
You can’t perform that action at this time.
0 commit comments