Skip to content

Commit

Permalink
Add a test for reflection of a view with spatial columns (#391)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien-berchet authored Jul 26, 2022
1 parent d24885d commit 8a9eeeb
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,24 @@ def test_raster_reflection(self, conn, Ocean, setup_tables):
type_ = t.c.rast.type
assert isinstance(type_, Raster)

@pytest.fixture
def ocean_view(self, conn, Ocean):
conn.execute("CREATE VIEW test_view AS SELECT * FROM ocean;")
yield Ocean
conn.execute("DROP VIEW test_view;")

def test_view_reflection(self, conn, Ocean, setup_tables, ocean_view):
"""Test reflection of a view.
Note: the reflected `Table` object has spatial indexes attached. It would be nice to detect
when a view is reflected to not attach any spatial index.
"""
skip_pg12_sa1217(conn)
skip_postgis1(conn)
t = Table('test_view', MetaData(), autoload_with=conn)
type_ = t.c.rast.type
assert isinstance(type_, Raster)


class TestToMetadata(ComparesTables):

Expand Down

0 comments on commit 8a9eeeb

Please sign in to comment.