Skip to content

Commit

Permalink
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 6fd9ae9 commit 353da53
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 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 All @@ -30,6 +31,7 @@
import ibis.expr.datatypes as dt
import ibis.expr.types as ir
from ibis.backends.tests.errors import PsycoPg2OperationalError
from ibis.util import gen_name

pytest.importorskip("psycopg2")

Expand Down Expand Up @@ -390,3 +392,28 @@ def test_password_with_bracket():
match=f'password authentication failed for user "{IBIS_POSTGRES_USER}"',
):
ibis.connect(url)


def test_create_geospatial_table_with_srid(con):
name = gen_name("geospatial")
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(
{
column: getattr(dt, dtype)(srid=4326)
for column, dtype in zip(column_names, column_types)
}
)

0 comments on commit 353da53

Please sign in to comment.