Skip to content

Commit 5b07017

Browse files
committed
fix(sqlalchemy-bigquery): wrap string in WKT in geography system tests and unskip
1 parent 81390d5 commit 5b07017

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

packages/sqlalchemy-bigquery/tests/system/test_geography.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
geoalchemy2 = 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.")
2725
def 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"
@@ -141,8 +139,6 @@ def test_geoalchemy2_core(bigquery_dataset):
141139
)
142140

143141

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.")
146142
def test_geoalchemy2_orm(bigquery_dataset):
147143
"""Make sure GeoAlchemy 2 ORM Tutorial works as adapted to only having geometry
148144
@@ -160,7 +156,7 @@ def test_geoalchemy2_orm(bigquery_dataset):
160156
from sqlalchemy import Column, Integer, String
161157
from sqlalchemy.ext.declarative import declarative_base
162158

163-
from sqlalchemy_bigquery import GEOGRAPHY
159+
from sqlalchemy_bigquery import GEOGRAPHY, WKT
164160

165161
Base = declarative_base()
166162

@@ -224,19 +220,19 @@ class Lake(Base):
224220

225221
from sqlalchemy import func
226222

227-
query = session.query(Lake).filter(func.ST_Contains(Lake.geog, "POINT(4 1)"))
223+
query = session.query(Lake).filter(func.ST_Contains(Lake.geog, WKT("POINT(4 1)")))
228224

229225
assert [lake.name for lake in query] == ["Orta"]
230226

231227
query = (
232228
session.query(Lake)
233-
.filter(Lake.geog.ST_Intersects("LINESTRING(2 1,4 1)"))
229+
.filter(Lake.geog.ST_Intersects(WKT("LINESTRING(2 1,4 1)")))
234230
.order_by(Lake.name)
235231
)
236232
assert [lake.name for lake in query] == ["Garde", "Orta"]
237233

238234
lake = session.query(Lake).filter_by(name="Garde").one()
239-
assert session.scalar(lake.geog.ST_Intersects("LINESTRING(2 1,4 1)"))
235+
assert session.scalar(lake.geog.ST_Intersects(WKT("LINESTRING(2 1,4 1)")))
240236

241237
# Use Other Spatial Functions
242238
query = session.query(Lake.name, func.ST_Area(Lake.geog).label("area")).order_by(
@@ -258,8 +254,6 @@ class Lake(Base):
258254
]
259255

260256

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.")
263257
def test_geoalchemy2_orm_w_relationship(bigquery_dataset):
264258
from sqlalchemy import create_engine
265259

0 commit comments

Comments
 (0)