Skip to content

Commit

Permalink
test-case
Browse files Browse the repository at this point in the history
  • Loading branch information
asg017 committed Nov 17, 2024
1 parent f55e14c commit 7f47409
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
6 changes: 6 additions & 0 deletions tests/__snapshots__/test-metadata.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,12 @@
]),
})
# ---
# name: test_long_text_knn[knn-eq-true]
dict({
'error': 'OperationalError',
'message': 'Could not filter metadata fields',
})
# ---
# name: test_long_text_updates
dict({
'v_chunks': OrderedDict({
Expand Down
20 changes: 18 additions & 2 deletions tests/test-metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,28 @@ def test_long_text_updates(db, snapshot):
)
assert vec0_shadow_table_contents(db, "v") == snapshot()
INSERT = "insert into v(vector, name) values (?, ?)"
assert exec(db, INSERT, [b"\x11\x11\x11\x11", "123456789a12"])
assert exec(db, INSERT, [b"\x11\x11\x11\x11", "123456789a123"])
exec(db, INSERT, [b"\x11\x11\x11\x11", "123456789a12"])
exec(db, INSERT, [b"\x11\x11\x11\x11", "123456789a123"])
assert exec(db, "select * from v") == snapshot()
assert vec0_shadow_table_contents(db, "v") == snapshot()


def test_long_text_knn(db, snapshot):
db.execute(
"create virtual table v using vec0(vector float[1], name text, chunk_size=8)"
)
INSERT = "insert into v(vector, name) values (?, ?)"
exec(db, INSERT, [b"\x11\x11\x11\x11", "aaaaaaaaaaaa_aaa"])
exec(db, INSERT, [b"\x11\x11\x11\x11", "aaaaaaaaaaaa_bbb"])
exec(db, INSERT, [b"\x11\x11\x11\x11", "aaaaaaaaaaaa_ccc"])

assert exec(
db,
"select * from v where vector match X'11111111' and k = 5 and name = ?",
["aaaaaaaaaaaa_aaa"],
) == snapshot(name="knn-eq-true")


def test_types(db, snapshot):
db.execute(
"create virtual table v using vec0(vector float[1], b boolean, n int, f float, t text, chunk_size=8)"
Expand Down

0 comments on commit 7f47409

Please sign in to comment.