Test and docs for timedelta support, refs #522

This commit is contained in:
Simon Willison 2023-11-03 17:54:37 -07:00
commit b2e0cd066d
2 changed files with 5 additions and 0 deletions

View file

@ -1217,6 +1217,7 @@ If you pass a Python type, it will be mapped to SQLite types as shown here::
datetime.datetime: "TEXT"
datetime.date: "TEXT"
datetime.time: "TEXT"
datetime.timedelta: "TEXT"
# If numpy is installed
np.int8: "INTEGER"

View file

@ -144,6 +144,10 @@ def test_create_table_with_not_null(fresh_db):
),
({"uuid": uuid.uuid4()}, [{"name": "uuid", "type": "TEXT"}]),
({"foo[bar]": 1}, [{"name": "foo_bar_", "type": "INTEGER"}]),
(
{"timedelta": datetime.timedelta(hours=1)},
[{"name": "timedelta", "type": "TEXT"}],
),
),
)
def test_create_table_from_example(fresh_db, example, expected_columns):