Skip to content

Commit a80f436

Browse files
authored
fix: corrects test for non-existent attribute (#1395)
* fix: corrects test for non-existent attribute * updates import statement to fix linting issue * updates a test to check for Python version * updates comments
1 parent 36c4a63 commit a80f436

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

google/cloud/bigquery/table.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@
4040

4141
try:
4242
import shapely # type: ignore
43+
from shapely import wkt # type: ignore
4344
except ImportError:
4445
shapely = None
4546
else:
46-
_read_wkt = shapely.wkt.loads
47+
_read_wkt = wkt.loads
4748

4849
import google.api_core.exceptions
4950
from google.api_core.page_iterator import HTTPIterator

samples/geography/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ db-dtypes==1.0.4
1010
Fiona==1.8.22
1111
geojson==2.5.0
1212
geopandas===0.10.2; python_version == '3.7'
13-
geopandas==0.11.1; python_version >= '3.8'
13+
geopandas==0.12.1; python_version >= '3.8'
1414
google-api-core==2.10.2
1515
google-auth==2.13.0
1616
google-cloud-bigquery==3.3.5

tests/unit/test_table.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import datetime
1616
import logging
1717
import re
18+
from sys import version_info
1819
import time
1920
import types
2021
import unittest
@@ -1969,7 +1970,10 @@ def test_to_geodataframe(self):
19691970
df = row_iterator.to_geodataframe(create_bqstorage_client=False)
19701971
self.assertIsInstance(df, geopandas.GeoDataFrame)
19711972
self.assertEqual(len(df), 0) # verify the number of rows
1972-
self.assertIsNone(df.crs)
1973+
if version_info.major == 3 and version_info.minor > 7:
1974+
assert not hasattr(df, "crs") # used with Python > 3.7
1975+
else:
1976+
self.assertIsNone(df.crs) # used with Python == 3.7
19731977

19741978

19751979
class TestRowIterator(unittest.TestCase):

0 commit comments

Comments
 (0)