From 6f9e9d46c407ff114a383b5a128770afdd0bb812 Mon Sep 17 00:00:00 2001 From: Zanie Date: Wed, 26 Jul 2023 11:13:59 -0500 Subject: [PATCH] Lint --- requirements.txt | 4 ++-- tests/test_databases.py | 24 +++++++++++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 46ed998b..589cd6d4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/tests/test_databases.py b/tests/test_databases.py index b786a526..1ed0b1bd 100644 --- a/tests/test_databases.py +++ b/tests/test_databases.py @@ -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: @@ -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