Skip to content

Commit

Permalink
extend existing foreign key test
Browse files Browse the repository at this point in the history
  • Loading branch information
Mause committed Dec 11, 2023
1 parent 3c05999 commit bca2d99
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions duckdb_engine/tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def test_preload_extension() -> None:

@fixture
def inspector(engine: Engine, session: Session) -> Inspector:
session.execute(text("create table test (id int);"))
session.execute(text("create table test (id int, primary key (id));"))
session.commit()

meta = MetaData()
Expand All @@ -259,11 +259,15 @@ def inspector(engine: Engine, session: Session) -> Inspector:


def test_get_columns(inspector: Inspector) -> None:
inspector.get_columns("test", None)
assert inspector.get_columns("test", None) == []


def test_get_foreign_keys(inspector: Inspector) -> None:
inspector.get_foreign_keys("test", None)
def test_get_foreign_keys(inspector: Inspector, session: Session) -> None:
session.execute(
text("create table test2 (id int, foreign_id int references test);")
)
assert len(set(inspector.get_table_names()) & {"test", "test2"}) == 2
assert inspector.get_foreign_keys("test", None) == []


@mark.skipif(
Expand Down

0 comments on commit bca2d99

Please sign in to comment.