Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb committed Jul 27, 2023
1 parent 995a3f4 commit 6f9e9d4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ aiosqlite==0.17.0
asyncpg==0.26.0

# Sync database drivers for standard tooling around setup/teardown/migrations.
psycopg2-binary==2.9.3
pymysql==1.0.2
# psycopg2-binary==2.9.3
# pymysql==1.0.2

# Testing
autoflake==1.4
Expand Down
24 changes: 23 additions & 1 deletion tests/test_databases.py
Original file line number Diff line number Diff line change
Expand Up @@ -1545,7 +1545,8 @@ async def test_mapping_property_interface(database_url):
list_result = await database.fetch_all(query=query)
assert list_result[0]._mapping["text"] == "example1"
assert list_result[0]._mapping["completed"] is True



@async_adapter
async def test_should_not_maintain_ref_when_no_cache_param():
async with Database("sqlite:///file::memory:", uri=True) as database:
Expand Down Expand Up @@ -1588,3 +1589,24 @@ async def test_should_remove_ref_on_disconnect():
query = notes.select()
with pytest.raises(sqlite3.OperationalError):
await database.fetch_all(query=query)


@pytest.mark.parametrize("database_url", DATABASE_URLS)
@async_adapter
async def test_mapping_property_interface(database_url):
"""
Test that all connections implement interface with `_mapping` property
"""
async with Database(database_url) as database:
query = notes.insert()
values = {"text": "example1", "completed": True}
await database.execute(query, values)

query = notes.select()
single_result = await database.fetch_one(query=query)
assert single_result._mapping["text"] == "example1"
assert single_result._mapping["completed"] is True

list_result = await database.fetch_all(query=query)
assert list_result[0]._mapping["text"] == "example1"
assert list_result[0]._mapping["completed"] is True

0 comments on commit 6f9e9d4

Please sign in to comment.