From b2e0cd066d5eda2ccfd1d63cd07191a209978395 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Fri, 3 Nov 2023 17:54:37 -0700 Subject: [PATCH] Test and docs for timedelta support, refs #522 --- docs/python-api.rst | 1 + tests/test_create.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/docs/python-api.rst b/docs/python-api.rst index e2974ea..9d396c6 100644 --- a/docs/python-api.rst +++ b/docs/python-api.rst @@ -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" diff --git a/tests/test_create.py b/tests/test_create.py index 92663e9..a88374f 100644 --- a/tests/test_create.py +++ b/tests/test_create.py @@ -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):