🔇 Do not raise deprecation warnings for execute as it's automatically used internally (#716)
* 🔇 Do not raise deprecation warnings for execute as it's automatically used internally * ✅ Tweak tests to not use deprecated query
This commit is contained in:
parent
2ecc86275f
commit
4ac87146b1
@ -95,7 +95,8 @@ class Session(_Session):
|
|||||||
```Python
|
```Python
|
||||||
heroes = session.exec(select(Hero)).all()
|
heroes = session.exec(select(Hero)).all()
|
||||||
```
|
```
|
||||||
"""
|
""",
|
||||||
|
category=None,
|
||||||
)
|
)
|
||||||
def execute( # type: ignore
|
def execute( # type: ignore
|
||||||
self,
|
self,
|
||||||
|
@ -3,7 +3,7 @@ from typing import List, Optional
|
|||||||
import pytest
|
import pytest
|
||||||
from sqlalchemy.exc import IntegrityError
|
from sqlalchemy.exc import IntegrityError
|
||||||
from sqlalchemy.orm import RelationshipProperty
|
from sqlalchemy.orm import RelationshipProperty
|
||||||
from sqlmodel import Field, Relationship, Session, SQLModel, create_engine
|
from sqlmodel import Field, Relationship, Session, SQLModel, create_engine, select
|
||||||
|
|
||||||
|
|
||||||
def test_should_allow_duplicate_row_if_unique_constraint_is_not_passed(clear_sqlmodel):
|
def test_should_allow_duplicate_row_if_unique_constraint_is_not_passed(clear_sqlmodel):
|
||||||
@ -31,7 +31,7 @@ def test_should_allow_duplicate_row_if_unique_constraint_is_not_passed(clear_sql
|
|||||||
session.refresh(hero_2)
|
session.refresh(hero_2)
|
||||||
|
|
||||||
with Session(engine) as session:
|
with Session(engine) as session:
|
||||||
heroes = session.query(Hero).all()
|
heroes = session.exec(select(Hero)).all()
|
||||||
assert len(heroes) == 2
|
assert len(heroes) == 2
|
||||||
assert heroes[0].name == heroes[1].name
|
assert heroes[0].name == heroes[1].name
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ def test_should_allow_duplicate_row_if_unique_constraint_is_false(clear_sqlmodel
|
|||||||
session.refresh(hero_2)
|
session.refresh(hero_2)
|
||||||
|
|
||||||
with Session(engine) as session:
|
with Session(engine) as session:
|
||||||
heroes = session.query(Hero).all()
|
heroes = session.exec(select(Hero)).all()
|
||||||
assert len(heroes) == 2
|
assert len(heroes) == 2
|
||||||
assert heroes[0].name == heroes[1].name
|
assert heroes[0].name == heroes[1].name
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user