Count rows with select() in the tests
`Session.query()` is the legacy API in SQLAlchemy 2.x.
This commit is contained in:
parent
455af6dfdb
commit
c1f04c65aa
1 changed files with 94 additions and 45 deletions
|
|
@ -1,6 +1,7 @@
|
|||
"""Integration test for the `velofy.console.gridify` module."""
|
||||
|
||||
import pytest
|
||||
import sqlalchemy as sa
|
||||
|
||||
import velofy
|
||||
from velofy import db
|
||||
|
|
@ -50,5 +51,5 @@ def test_two_pixels_with_two_addresses(
|
|||
|
||||
assert result.exit_code == 0
|
||||
|
||||
assert db_session.query(db.Grid).count() == 1
|
||||
assert db_session.query(db.Pixel).count() == 2
|
||||
assert db_session.scalar(sa.select(sa.func.count()).select_from(db.Grid)) == 1
|
||||
assert db_session.scalar(sa.select(sa.func.count()).select_from(db.Pixel)) == 2
|
||||
|
|
|
|||
Loading…
Reference in a new issue