Skip to content

Commit 858e6b1

Browse files
committed
Added more tests for bad type
1 parent f605253 commit 858e6b1

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

tests/test_sqlalchemy.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,13 +468,27 @@ def test_sum_orm(self, engine: Engine) -> None:
468468
res = session.scalars(select(sum(Item.embedding))).one()
469469
assert res == [5, 7, 9]
470470

471-
def test_bad_type(self, engine: Engine) -> None:
471+
def test_vector_bad_type(self, engine: Engine) -> None:
472472
item = Item(embedding=[1, 'two'])
473473
with Session(engine) as session:
474474
session.add(item)
475475
with pytest.raises(StatementError, match='could not convert string to float'):
476476
session.commit()
477477

478+
def test_halfvec_bad_type(self, engine: Engine) -> None:
479+
item = Item(half_embedding=[1, 'two'])
480+
with Session(engine) as session:
481+
session.add(item)
482+
with pytest.raises(StatementError, match='could not convert string to float'):
483+
session.commit()
484+
485+
def test_sparsevec_bad_type(self, engine: Engine) -> None:
486+
item = Item(sparse_embedding=[1, 'two'])
487+
with Session(engine) as session:
488+
session.add(item)
489+
with pytest.raises(StatementError, match='could not convert string to float'):
490+
session.commit()
491+
478492
def test_bad_dimensions(self, engine: Engine) -> None:
479493
item = Item(embedding=[1, 2])
480494
with Session(engine) as session:

0 commit comments

Comments
 (0)