finish type checking

This commit is contained in:
Alex Garcia 2024-11-13 22:26:06 -08:00
parent 9fffdc4d1b
commit f12be5292b
3 changed files with 33 additions and 17 deletions

View file

@ -1154,24 +1154,28 @@
'message': 'Expected 0 or 1 for BOOLEAN metadata column b',
})
# ---
# name: test_types[illegal-float]
OrderedDict({
'sql': 'insert into v(vector, b, n, f, t) values (?, ?, ?, ?, ?)',
'rows': list([
]),
# name: test_types[illegal-type-boolean]
dict({
'error': 'OperationalError',
'message': 'Expected 0 or 1 for BOOLEAN metadata column b',
})
# ---
# name: test_types[illegal-int]
# name: test_types[illegal-type-float]
dict({
'error': 'OperationalError',
'message': 'Expected float for FLOAT metadata column f, received TEXT',
})
# ---
# name: test_types[illegal-type-int]
dict({
'error': 'OperationalError',
'message': 'Expected integer for INTEGER metadata column n, received TEXT',
})
# ---
# name: test_types[illegal-text]
OrderedDict({
'sql': 'insert into v(vector, b, n, f, t) values (?, ?, ?, ?, ?)',
'rows': list([
]),
# name: test_types[illegal-type-text]
dict({
'error': 'OperationalError',
'message': 'Expected text for TEXT metadata column t, received INTEGER',
})
# ---
# name: test_types[legal]

View file

@ -55,12 +55,16 @@ def test_types(db, snapshot):
)
# fmt: off
assert exec(db, INSERT, [b"\x11\x11\x11\x11", 'illegal', 1, 1.1, 'test']) == snapshot(name="illegal-boolean")
assert exec(db, INSERT, [b"\x11\x11\x11\x11", 1, 'illegal', 1.1, 'test']) == snapshot(name="illegal-int")
assert exec(db, INSERT, [b"\x11\x11\x11\x11", 1, 1, 'illegal', 'test']) == snapshot(name="illegal-float")
assert exec(db, INSERT, [b"\x11\x11\x11\x11", 1, 1, 1.1, 420]) == snapshot(name="illegal-text")
assert exec(db, INSERT, [b"\x11\x11\x11\x11", 'illegal', 1, 1.1, 'test']) == snapshot(name="illegal-type-boolean")
assert exec(db, INSERT, [b"\x11\x11\x11\x11", 1, 'illegal', 1.1, 'test']) == snapshot(name="illegal-type-int")
assert exec(db, INSERT, [b"\x11\x11\x11\x11", 1, 1, 'illegal', 'test']) == snapshot(name="illegal-type-float")
assert exec(db, INSERT, [b"\x11\x11\x11\x11", 1, 1, 1.1, 420]) == snapshot(name="illegal-type-text")
# fmt: on
assert exec(db, INSERT, [b"\x11\x11\x11\x11", 44, 1, 1.1, "test"]) == snapshot(
name="illegal-boolean"
)
def test_updates(db, snapshot):
pass