Better error message if table has no columns, closes #424

This commit is contained in:
Simon Willison 2022-04-13 15:39:48 -07:00
commit 0e60f3c80c
2 changed files with 7 additions and 0 deletions

View file

@ -1149,3 +1149,9 @@ def test_create_if_not_exists(fresh_db):
fresh_db["t"].create({"id": int})
# This should not
fresh_db["t"].create({"id": int}, if_not_exists=True)
def test_create_if_no_columns(fresh_db):
with pytest.raises(AssertionError) as error:
fresh_db["t"].create({})
assert error.value.args[0] == "Tables must have at least one column"