2222geoalchemy2 = pytest .importorskip ("geoalchemy2" )
2323
2424
25- # TODO(http://github.com/googleapis/google-cloud-python/issues/17287): Unskip once bug is resolved.
26- @pytest .mark .skip (reason = "Failing in CI with AssertionError." )
2725def test_geoalchemy2_core (bigquery_dataset ):
2826 """Make sure GeoAlchemy 2 Core Tutorial works as adapted to only having geography
2927
@@ -44,7 +42,7 @@ def test_geoalchemy2_core(bigquery_dataset):
4442
4543 from sqlalchemy import Column , MetaData , String , Table
4644
47- from sqlalchemy_bigquery import GEOGRAPHY
45+ from sqlalchemy_bigquery import GEOGRAPHY , WKT
4846
4947 metadata = MetaData ()
5048 lake_table = Table (
@@ -86,7 +84,7 @@ def test_geoalchemy2_core(bigquery_dataset):
8684
8785 [[result ]] = conn .execute (
8886 select (lake_table .c .name ).where (
89- func .ST_Contains (lake_table .c .geog , "POINT(4 1)" )
87+ func .ST_Contains (lake_table .c .geog , WKT ( "POINT(4 1)" ) )
9088 )
9189 )
9290 assert result == "Orta"
@@ -119,8 +117,6 @@ def test_geoalchemy2_core(bigquery_dataset):
119117
120118 # and, while we're at it, that we can insert WKTs, although we
121119 # normally wouldn't want to.
122- from sqlalchemy_bigquery import WKT
123-
124120 conn .execute (
125121 lake_table .insert ().values (
126122 name = "test2" ,
@@ -141,8 +137,6 @@ def test_geoalchemy2_core(bigquery_dataset):
141137 )
142138
143139
144- # TODO(http://github.com/googleapis/google-cloud-python/issues/17287): Unskip once bug is resolved.
145- @pytest .mark .skip (reason = "Failing in CI with AssertionError." )
146140def test_geoalchemy2_orm (bigquery_dataset ):
147141 """Make sure GeoAlchemy 2 ORM Tutorial works as adapted to only having geometry
148142
@@ -160,7 +154,7 @@ def test_geoalchemy2_orm(bigquery_dataset):
160154 from sqlalchemy import Column , Integer , String
161155 from sqlalchemy .ext .declarative import declarative_base
162156
163- from sqlalchemy_bigquery import GEOGRAPHY
157+ from sqlalchemy_bigquery import GEOGRAPHY , WKT
164158
165159 Base = declarative_base ()
166160
@@ -224,19 +218,19 @@ class Lake(Base):
224218
225219 from sqlalchemy import func
226220
227- query = session .query (Lake ).filter (func .ST_Contains (Lake .geog , "POINT(4 1)" ))
221+ query = session .query (Lake ).filter (func .ST_Contains (Lake .geog , WKT ( "POINT(4 1)" ) ))
228222
229223 assert [lake .name for lake in query ] == ["Orta" ]
230224
231225 query = (
232226 session .query (Lake )
233- .filter (Lake .geog .ST_Intersects ("LINESTRING(2 1,4 1)" ))
227+ .filter (Lake .geog .ST_Intersects (WKT ( "LINESTRING(2 1,4 1)" ) ))
234228 .order_by (Lake .name )
235229 )
236230 assert [lake .name for lake in query ] == ["Garde" , "Orta" ]
237231
238232 lake = session .query (Lake ).filter_by (name = "Garde" ).one ()
239- assert session .scalar (lake .geog .ST_Intersects ("LINESTRING(2 1,4 1)" ))
233+ assert session .scalar (lake .geog .ST_Intersects (WKT ( "LINESTRING(2 1,4 1)" ) ))
240234
241235 # Use Other Spatial Functions
242236 query = session .query (Lake .name , func .ST_Area (Lake .geog ).label ("area" )).order_by (
@@ -258,8 +252,6 @@ class Lake(Base):
258252 ]
259253
260254
261- # TODO(http://github.com/googleapis/google-cloud-python/issues/17287): Unskip once bug is resolved.
262- @pytest .mark .skip (reason = "Failing in CI with AssertionError." )
263255def test_geoalchemy2_orm_w_relationship (bigquery_dataset ):
264256 from sqlalchemy import create_engine
265257
0 commit comments