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

Commit b4edb9c

Browse files
committed
updates to several tests re geopandas as well as imports
1 parent 2bd1992 commit b4edb9c

5 files changed

Lines changed: 22 additions & 8 deletions

File tree

noxfile.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,7 @@ def default(session, install_extras=True):
109109
# that logic (and the associated tests) we avoid installing the [ipython] extra
110110
# which has a downstream effect of then avoiding installing bigquery_magics.
111111
if install_extras and session.python == UNIT_TEST_PYTHON_VERSIONS[0]:
112-
install_target = (
113-
".[bqstorage,pandas,ipywidgets,geopandas,tqdm,opentelemetry,bigquery_v2]"
114-
)
112+
install_target = ".[bqstorage,pandas,ipywidgets,geopandas,matplotlib,tqdm,opentelemetry,bigquery_v2]"
115113
elif install_extras: # run against all other UNIT_TEST_PYTHON_VERSIONS
116114
install_target = ".[all]"
117115
else:

pyproject.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,11 @@ pandas = [
8282
ipywidgets = ["ipywidgets >= 7.7.1", "ipykernel >= 6.2.0"]
8383
geopandas = ["geopandas >= 0.9.0, < 2.0.0", "Shapely >= 1.8.4, < 3.0.0"]
8484
ipython = ["ipython >= 7.23.1", "bigquery-magics >= 0.6.0"]
85-
tqdm = ["tqdm >= 4.7.4, < 5.0.0"]
85+
matplotlib = [
86+
"matplotlib == 3.9.2; python_version == '3.9'",
87+
"matplotlib >= 3.10.3; python_version >= '3.10'",
88+
]
89+
tqdm = ["tqdm >= 4.23.4, < 5.0.0"]
8690
opentelemetry = [
8791
"opentelemetry-api >= 1.1.0",
8892
"opentelemetry-sdk >= 1.1.0",
@@ -93,7 +97,7 @@ bigquery_v2 = [
9397
"protobuf >= 3.20.2, < 7.0.0, != 4.21.0, != 4.21.1, != 4.21.2, != 4.21.3, != 4.21.4, != 4.21.5", # For the legacy proto-based types.
9498
]
9599
all = [
96-
"google-cloud-bigquery[bqstorage,pandas,ipywidgets,geopandas,ipython,tqdm,opentelemetry,bigquery_v2]",
100+
"google-cloud-bigquery[bqstorage,pandas,ipywidgets,geopandas,ipython,matplotlib,tqdm,opentelemetry,bigquery_v2]",
97101
]
98102

99103
[tool.setuptools.dynamic]

testing/constraints-3.9.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ pyarrow==4.0.0
2929
python-dateutil==2.8.2
3030
requests==2.21.0
3131
Shapely==1.8.4
32-
tqdm==4.7.4
32+
tqdm==4.23.4

tests/unit/job/test_query_pandas.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,8 @@ def test_query_job_to_geodataframe_delegation(wait_for_query):
10001000
max_results = 42
10011001
geography_column = "g"
10021002

1003+
from google.cloud.bigquery.enums import DefaultPandasDTypes
1004+
10031005
df = job.to_geodataframe(
10041006
bqstorage_client=bqstorage_client,
10051007
dtypes=dtypes,
@@ -1019,5 +1021,9 @@ def test_query_job_to_geodataframe_delegation(wait_for_query):
10191021
progress_bar_type=progress_bar_type,
10201022
create_bqstorage_client=create_bqstorage_client,
10211023
geography_column=geography_column,
1024+
bool_dtype=DefaultPandasDTypes.BOOL_DTYPE,
1025+
int_dtype=DefaultPandasDTypes.INT_DTYPE,
1026+
float_dtype=None,
1027+
string_dtype=None,
10221028
)
10231029
assert df is row_iterator.to_geodataframe.return_value

tests/unit/test_table.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4065,7 +4065,7 @@ def test_to_dataframe_no_tqdm(self):
40654065

40664066
def test_to_dataframe_tqdm_error(self):
40674067
pytest.importorskip("pandas")
4068-
pytest.importorskip("tqdm")
4068+
tqdm = pytest.importorskip("tqdm")
40694069
mock.patch("tqdm.tqdm_gui", new=None)
40704070
mock.patch("tqdm.notebook.tqdm", new=None)
40714071
mock.patch("tqdm.tqdm", new=None)
@@ -4100,7 +4100,7 @@ def test_to_dataframe_tqdm_error(self):
41004100
for warning in warned: # pragma: NO COVER
41014101
self.assertIn(
41024102
warning.category,
4103-
[UserWarning, DeprecationWarning],
4103+
[UserWarning, DeprecationWarning, tqdm.TqdmExperimentalWarning],
41044104
)
41054105

41064106
def test_to_dataframe_w_empty_results(self):
@@ -5633,12 +5633,18 @@ def test_rowiterator_to_geodataframe_delegation(self, to_dataframe):
56335633
geography_column=geography_column,
56345634
)
56355635

5636+
from google.cloud.bigquery.enums import DefaultPandasDTypes
5637+
56365638
to_dataframe.assert_called_once_with(
56375639
bqstorage_client,
56385640
dtypes,
56395641
progress_bar_type,
56405642
create_bqstorage_client,
56415643
geography_as_object=True,
5644+
bool_dtype=DefaultPandasDTypes.BOOL_DTYPE,
5645+
int_dtype=DefaultPandasDTypes.INT_DTYPE,
5646+
float_dtype=None,
5647+
string_dtype=None,
56425648
)
56435649

56445650
self.assertIsInstance(df, geopandas.GeoDataFrame)

0 commit comments

Comments
 (0)