Skip to content

Commit 37b4d39

Browse files
committed
added tests for --max_results magic option
1 parent 7176592 commit 37b4d39

2 files changed

Lines changed: 2 additions & 14 deletions

File tree

‎bigquery/google/cloud/bigquery/magics.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ def _run_query(client, query, job_config=None, max_results=None):
320320
default=None,
321321
help=("Project to use for executing this query. Defaults to the context project."),
322322
)
323-
324323
@magic_arguments.argument(
325324
"--max_results",
326325
default=None,
@@ -329,7 +328,6 @@ def _run_query(client, query, job_config=None, max_results=None):
329328
"Defaults to returning all rows."
330329
),
331330
)
332-
333331
@magic_arguments.argument(
334332
"--max_results",
335333
default=None,

‎bigquery/tests/unit/test_magics.py‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -414,11 +414,7 @@ def test_bigquery_magic_with_legacy_sql():
414414
with run_query_patch as run_query_mock:
415415
ip.run_cell_magic("bigquery", "--use_legacy_sql", "SELECT 17 AS num")
416416

417-
<<<<<<< HEAD
418417
job_config_used = run_query_mock.call_args_list[0][1]["job_config"]
419-
=======
420-
job_config_used = run_query_mock.call_args_list[0][1]['job_config']
421-
>>>>>>> d4fa587dacf... added max_results magic option and fixed broken tests
422418
assert job_config_used.use_legacy_sql is True
423419

424420

@@ -979,13 +975,10 @@ def test_bigquery_magic_with_string_params():
979975
run_query_mock.return_value = query_job_mock
980976

981977
ip.run_cell_magic("bigquery", 'params_string_df --params {"num":17}', sql)
982-
<<<<<<< HEAD
978+
983979
run_query_mock.assert_called_once_with(
984980
mock.ANY, sql.format(num=17), mock.ANY, max_results=None
985981
)
986-
=======
987-
run_query_mock.assert_called_once_with(mock.ANY, sql.format(num=17), mock.ANY, max_results=None)
988-
>>>>>>> d4fa587dacf... added max_results magic option and fixed broken tests
989982

990983
assert "params_string_df" in ip.user_ns # verify that the variable exists
991984
df = ip.user_ns["params_string_df"]
@@ -1020,13 +1013,10 @@ def test_bigquery_magic_with_dict_params():
10201013
# Insert dictionary into user namespace so that it can be expanded
10211014
ip.user_ns["params"] = params
10221015
ip.run_cell_magic("bigquery", "params_dict_df --params $params", sql)
1023-
<<<<<<< HEAD
1016+
10241017
run_query_mock.assert_called_once_with(
10251018
mock.ANY, sql.format(num=17), mock.ANY, max_results=None
10261019
)
1027-
=======
1028-
run_query_mock.assert_called_once_with(mock.ANY, sql.format(num=17), mock.ANY, max_results=None)
1029-
>>>>>>> d4fa587dacf... added max_results magic option and fixed broken tests
10301020

10311021
assert "params_dict_df" in ip.user_ns # verify that the variable exists
10321022
df = ip.user_ns["params_dict_df"]

0 commit comments

Comments
 (0)