Skip to content

Commit

Permalink
⬆️ Upgrade support for SQLAlchemy 1.4.49, update tests (#519)
Browse files Browse the repository at this point in the history
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 23, 2023
1 parent d281a0f commit d1cf613
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ classifiers = [

[tool.poetry.dependencies]
python = "^3.7"
SQLAlchemy = ">=1.4.29,<=1.4.41"
SQLAlchemy = ">=1.4.29,<2.0.0"
pydantic = "^1.8.2"
sqlalchemy2-stubs = {version = "*", allow-prereleases = true}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,18 @@ def test_tutorial(clear_sqlmodel):
insp: Inspector = inspect(mod.engine)
indexes = insp.get_indexes(str(mod.Hero.__tablename__))
expected_indexes = [
{"name": "ix_hero_name", "column_names": ["name"], "unique": 0},
{"name": "ix_hero_age", "column_names": ["age"], "unique": 0},
{
"name": "ix_hero_name",
"dialect_options": {},
"column_names": ["name"],
"unique": 0,
},
{
"name": "ix_hero_age",
"dialect_options": {},
"column_names": ["age"],
"unique": 0,
},
]
for index in expected_indexes:
assert index in indexes, "This expected index should be in the indexes in DB"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,18 @@ def test_tutorial(clear_sqlmodel):
insp: Inspector = inspect(mod.engine)
indexes = insp.get_indexes(str(mod.Hero.__tablename__))
expected_indexes = [
{"name": "ix_hero_age", "column_names": ["age"], "unique": 0},
{"name": "ix_hero_name", "column_names": ["name"], "unique": 0},
{
"name": "ix_hero_age",
"dialect_options": {},
"column_names": ["age"],
"unique": 0,
},
{
"name": "ix_hero_name",
"dialect_options": {},
"column_names": ["name"],
"unique": 0,
},
]
for index in expected_indexes:
assert index in indexes, "This expected index should be in the indexes in DB"
Expand Down
14 changes: 12 additions & 2 deletions tests/test_tutorial/test_indexes/test_tutorial001.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,18 @@ def test_tutorial(clear_sqlmodel):
insp: Inspector = inspect(mod.engine)
indexes = insp.get_indexes(str(mod.Hero.__tablename__))
expected_indexes = [
{"name": "ix_hero_name", "column_names": ["name"], "unique": 0},
{"name": "ix_hero_age", "column_names": ["age"], "unique": 0},
{
"name": "ix_hero_name",
"dialect_options": {},
"column_names": ["name"],
"unique": 0,
},
{
"name": "ix_hero_age",
"dialect_options": {},
"column_names": ["age"],
"unique": 0,
},
]
for index in expected_indexes:
assert index in indexes, "This expected index should be in the indexes in DB"
Expand Down
14 changes: 12 additions & 2 deletions tests/test_tutorial/test_indexes/test_tutorial006.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,18 @@ def test_tutorial(clear_sqlmodel):
insp: Inspector = inspect(mod.engine)
indexes = insp.get_indexes(str(mod.Hero.__tablename__))
expected_indexes = [
{"name": "ix_hero_name", "column_names": ["name"], "unique": 0},
{"name": "ix_hero_age", "column_names": ["age"], "unique": 0},
{
"name": "ix_hero_name",
"dialect_options": {},
"column_names": ["name"],
"unique": 0,
},
{
"name": "ix_hero_age",
"dialect_options": {},
"column_names": ["age"],
"unique": 0,
},
]
for index in expected_indexes:
assert index in indexes, "This expected index should be in the indexes in DB"
Expand Down

0 comments on commit d1cf613

Please sign in to comment.