Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 253de65

Browse files
committed
fix unit tests
1 parent d1a7f70 commit 253de65

3 files changed

Lines changed: 52 additions & 46 deletions

File tree

bigframes/dataframe.py

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4630,24 +4630,24 @@ def to_string(
46304630
) -> str | None:
46314631
return self.to_pandas(allow_large_results=allow_large_results).to_string(
46324632
buf,
4633-
columns, # type: ignore
4634-
col_space,
4635-
header, # type: ignore
4636-
index,
4637-
na_rep,
4638-
formatters,
4639-
float_format,
4640-
sparsify,
4641-
index_names,
4642-
justify,
4643-
max_rows,
4644-
max_cols,
4645-
show_dimensions,
4646-
decimal,
4647-
line_width,
4648-
min_rows,
4649-
max_colwidth,
4650-
encoding,
4633+
columns=columns, # type: ignore
4634+
col_space=col_space,
4635+
header=header, # type: ignore
4636+
index=index,
4637+
na_rep=na_rep,
4638+
formatters=formatters,
4639+
float_format=float_format,
4640+
sparsify=sparsify,
4641+
index_names=index_names,
4642+
justify=justify,
4643+
max_rows=max_rows,
4644+
max_cols=max_cols,
4645+
show_dimensions=show_dimensions,
4646+
decimal=decimal,
4647+
line_width=line_width,
4648+
min_rows=min_rows,
4649+
max_colwidth=max_colwidth,
4650+
encoding=encoding,
46514651
)
46524652

46534653
def to_html(
@@ -4680,28 +4680,28 @@ def to_html(
46804680
) -> str:
46814681
return self.to_pandas(allow_large_results=allow_large_results).to_html(
46824682
buf,
4683-
columns, # type: ignore
4684-
col_space,
4685-
header,
4686-
index,
4687-
na_rep,
4688-
formatters,
4689-
float_format,
4690-
sparsify,
4691-
index_names,
4692-
justify, # type: ignore
4693-
max_rows,
4694-
max_cols,
4695-
show_dimensions,
4696-
decimal,
4697-
bold_rows,
4698-
classes,
4699-
escape,
4700-
notebook,
4701-
border,
4702-
table_id,
4703-
render_links,
4704-
encoding,
4683+
columns=columns, # type: ignore
4684+
col_space=col_space,
4685+
header=header,
4686+
index=index,
4687+
na_rep=na_rep,
4688+
formatters=formatters,
4689+
float_format=float_format,
4690+
sparsify=sparsify,
4691+
index_names=index_names,
4692+
justify=justify, # type: ignore
4693+
max_rows=max_rows,
4694+
max_cols=max_cols,
4695+
show_dimensions=show_dimensions,
4696+
decimal=decimal,
4697+
bold_rows=bold_rows,
4698+
classes=classes,
4699+
escape=escape,
4700+
notebook=notebook,
4701+
border=border,
4702+
table_id=table_id,
4703+
render_links=render_links,
4704+
encoding=encoding,
47054705
)
47064706

47074707
def to_markdown(
@@ -4713,7 +4713,7 @@ def to_markdown(
47134713
allow_large_results: Optional[bool] = None,
47144714
**kwargs,
47154715
) -> str | None:
4716-
return self.to_pandas(allow_large_results=allow_large_results).to_markdown(buf, mode, index, **kwargs) # type: ignore
4716+
return self.to_pandas(allow_large_results=allow_large_results).to_markdown(buf, mode=mode, index=index, **kwargs) # type: ignore
47174717

47184718
def to_pickle(self, path, *, allow_large_results=None, **kwargs) -> None:
47194719
return self.to_pandas(allow_large_results=allow_large_results).to_pickle(

bigframes/testing/mocks.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ def query_and_wait_mock(query, *args, job_config=None, **kwargs):
143143

144144
bqclient.query.side_effect = query_mock
145145
bqclient.query_and_wait.side_effect = query_and_wait_mock
146+
bqclient._query_and_wait_bigframes.side_effect = query_and_wait_mock
146147

147148
clients_provider = mock.create_autospec(bigframes.session.clients.ClientsProvider)
148149
type(clients_provider).bqclient = mock.PropertyMock(return_value=bqclient)

tests/unit/session/test_session.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def test_read_gbq_cached_table():
247247
table,
248248
)
249249

250-
session.bqclient.query_and_wait = mock.MagicMock(
250+
session.bqclient._query_and_wait_bigframes = mock.MagicMock(
251251
return_value=({"total_count": 3, "distinct_count": 2},)
252252
)
253253
session.bqclient.get_table.return_value = table
@@ -278,7 +278,7 @@ def test_read_gbq_cached_table_doesnt_warn_for_anonymous_tables_and_doesnt_inclu
278278
table,
279279
)
280280

281-
session.bqclient.query_and_wait = mock.MagicMock(
281+
session.bqclient._query_and_wait_bigframes = mock.MagicMock(
282282
return_value=({"total_count": 3, "distinct_count": 2},)
283283
)
284284
session.bqclient.get_table.return_value = table
@@ -306,7 +306,9 @@ def test_default_index_warning_raised_by_read_gbq(table):
306306
bqclient = mock.create_autospec(google.cloud.bigquery.Client, instance=True)
307307
bqclient.project = "test-project"
308308
bqclient.get_table.return_value = table
309-
bqclient.query_and_wait.return_value = ({"total_count": 3, "distinct_count": 2},)
309+
bqclient._query_and_wait_bigframes.return_value = (
310+
{"total_count": 3, "distinct_count": 2},
311+
)
310312
session = mocks.create_bigquery_session(
311313
bqclient=bqclient,
312314
# DefaultIndexWarning is only relevant for strict mode.
@@ -333,7 +335,9 @@ def test_default_index_warning_not_raised_by_read_gbq_index_col_sequential_int64
333335
bqclient = mock.create_autospec(google.cloud.bigquery.Client, instance=True)
334336
bqclient.project = "test-project"
335337
bqclient.get_table.return_value = table
336-
bqclient.query_and_wait.return_value = ({"total_count": 4, "distinct_count": 3},)
338+
bqclient._query_and_wait_bigframes.return_value = (
339+
{"total_count": 4, "distinct_count": 3},
340+
)
337341
session = mocks.create_bigquery_session(
338342
bqclient=bqclient,
339343
# DefaultIndexWarning is only relevant for strict mode.
@@ -382,7 +386,7 @@ def test_default_index_warning_not_raised_by_read_gbq_index_col_columns(
382386
bqclient = mock.create_autospec(google.cloud.bigquery.Client, instance=True)
383387
bqclient.project = "test-project"
384388
bqclient.get_table.return_value = table
385-
bqclient.query_and_wait.return_value = (
389+
bqclient._query_and_wait_bigframes.return_value = (
386390
{"total_count": total_count, "distinct_count": distinct_count},
387391
)
388392
session = mocks.create_bigquery_session(
@@ -492,6 +496,7 @@ def query_mock(query, *args, **kwargs):
492496
return session_query_mock(query, *args, **kwargs)
493497

494498
session.bqclient.query_and_wait = query_mock
499+
session.bqclient._query_and_wait_bigframes = query_mock
495500

496501
def get_table_mock(table_ref):
497502
table = google.cloud.bigquery.Table(

0 commit comments

Comments
 (0)