Skip to content

Commit 8ebbe1a

Browse files
Export PEP 249 type constructors and objects from aio module
The async module was missing Date, Time, Timestamp, Binary and the type objects STRING, BINARY, NUMBER, DATETIME, ROWID. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 05610e1 commit 8ebbe1a

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

src/dqlitedbapi/aio/__init__.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,20 @@
1414
ProgrammingError,
1515
Warning,
1616
)
17+
from dqlitedbapi.types import (
18+
BINARY,
19+
DATETIME,
20+
NUMBER,
21+
ROWID,
22+
STRING,
23+
Binary,
24+
Date,
25+
DateFromTicks,
26+
Time,
27+
TimeFromTicks,
28+
Timestamp,
29+
TimestampFromTicks,
30+
)
1731

1832
# PEP 249 module-level attributes (required by SQLAlchemy dialect initialization)
1933
apilevel = "2.0"
@@ -46,6 +60,20 @@
4660
"InternalError",
4761
"ProgrammingError",
4862
"NotSupportedError",
63+
# Type constructors
64+
"Date",
65+
"Time",
66+
"Timestamp",
67+
"DateFromTicks",
68+
"TimeFromTicks",
69+
"TimestampFromTicks",
70+
"Binary",
71+
# Type objects
72+
"STRING",
73+
"BINARY",
74+
"NUMBER",
75+
"DATETIME",
76+
"ROWID",
4977
]
5078

5179

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""Tests for async module PEP 249 attributes and exports."""
2+
3+
from dqlitedbapi import aio
4+
5+
6+
class TestAioModuleAttributes:
7+
def test_apilevel(self) -> None:
8+
assert aio.apilevel == "2.0"
9+
10+
def test_threadsafety(self) -> None:
11+
assert aio.threadsafety == 1
12+
13+
def test_paramstyle(self) -> None:
14+
assert aio.paramstyle == "qmark"
15+
16+
def test_type_constructors_exported(self) -> None:
17+
"""PEP 249 type constructors should be available from aio module."""
18+
assert callable(aio.Date)
19+
assert callable(aio.Time)
20+
assert callable(aio.Timestamp)
21+
assert callable(aio.DateFromTicks)
22+
assert callable(aio.TimeFromTicks)
23+
assert callable(aio.TimestampFromTicks)
24+
assert callable(aio.Binary)
25+
26+
def test_type_objects_exported(self) -> None:
27+
"""PEP 249 type objects should be available from aio module."""
28+
assert aio.STRING == "TEXT"
29+
assert aio.BINARY == "BLOB"
30+
assert aio.NUMBER == "INTEGER"
31+
assert aio.DATETIME == "DATE"
32+
assert aio.ROWID == "ROWID"

0 commit comments

Comments
 (0)