Use REAL for floating point columns if table is strict, closes #644

Refs #645
This commit is contained in:
Simon Willison 2024-11-23 14:27:21 -08:00
commit 4dc2e2e9c8
4 changed files with 17 additions and 3 deletions

View file

@ -1350,8 +1350,12 @@ def test_insert_upsert_strict(fresh_db, method_name, strict):
@pytest.mark.parametrize("strict", (False, True))
def test_create_table_strict(fresh_db, strict):
table = fresh_db.create_table("t", {"id": int}, strict=strict)
table = fresh_db.create_table("t", {"id": int, "f": float}, strict=strict)
assert table.strict == strict or not fresh_db.supports_strict
expected_schema = "CREATE TABLE [t] (\n" " [id] INTEGER,\n" " [f] FLOAT\n" ")"
if strict:
expected_schema = "CREATE TABLE [t] (\n [id] INTEGER,\n [f] REAL\n) STRICT"
assert table.schema == expected_schema
@pytest.mark.parametrize("strict", (False, True))