int8 vec from text (#17)

* parse int8 vec from json format text

* add small test cases for text based loading
This commit is contained in:
Daniel Levi-Minzi 2024-06-08 14:50:10 -04:00 committed by GitHub
parent 8c418f9349
commit e9bf355a70
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 99 additions and 0 deletions

View file

@ -211,6 +211,8 @@ def test_vec_int8():
vec_int8 = lambda *args: db.execute("select vec_int8(?)", args).fetchone()[0]
assert vec_int8(b"\x00") == _int8([0])
assert vec_int8(b"\x00\x0f") == _int8([0, 15])
assert vec_int8("[0]") == _int8([0])
assert vec_int8("[1, 2, 3]") == _int8([1, 2, 3])
if SUPPORTS_SUBTYPE:
assert db.execute("select subtype(vec_int8(?))", [b"\x00"]).fetchone()[0] == 225