Skip to content

Commit

Permalink
fixup! test(postgres): add srid create table test
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Jul 5, 2024
1 parent abdefd7 commit 7671a17
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions ibis/backends/postgres/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from __future__ import annotations

import os
import string
from urllib.parse import quote_plus

import hypothesis as h
Expand Down Expand Up @@ -395,7 +396,24 @@ def test_password_with_bracket():

def test_create_geospatial_table_with_srid(con):
name = gen_name("geospatial")
sql = f"CREATE TEMP TABLE {name} (lonlat geometry(Point, 4326))"
con.raw_sql(sql)
column_names = string.ascii_lowercase
column_types = [
"Point",
"LineString",
"Polygon",
"MultiLineString",
"MultiPoint",
"MultiPolygon",
]
schema_string = ", ".join(
f"{column} geometry({dtype}, 4326)"
for column, dtype in zip(column_names, column_types)
)
con.raw_sql(f"CREATE TEMP TABLE {name} ({schema_string})")
t = con.table(name)
assert t.schema() == ibis.schema({"lonlat": dt.Point(srid=4326)})
assert t.schema() == ibis.schema(
{
column: getattr(dt, dtype)(srid=4326)
for column, dtype in zip(column_names, column_types)
}
)

0 comments on commit 7671a17

Please sign in to comment.