Skip to content

Commit 8a3dadb

Browse files
committed
Simplified tests [skip ci]
1 parent a920f04 commit 8a3dadb

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

tests/test_pg8000.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,14 @@ def setup_method(self):
2525

2626
def test_vector(self):
2727
embedding = Vector([1.5, 2, 3])
28-
embedding2 = None
29-
conn.run('INSERT INTO pg8000_items (embedding) VALUES (:embedding), (:embedding2)', embedding=embedding, embedding2=embedding2)
28+
embedding2 = np.array([4.5, 5, 6]) if NUMPY_AVAILABLE else [4.5, 5, 6]
29+
embedding3 = None
30+
conn.run('INSERT INTO pg8000_items (embedding) VALUES (:embedding), (:embedding2), (:embedding3)', embedding=embedding, embedding2=embedding2, embedding3=embedding3)
3031

3132
res = conn.run('SELECT embedding FROM pg8000_items ORDER BY id')
3233
assert res[0][0] == embedding
33-
assert res[1][0] is None
34-
35-
@pytest.mark.skipif(not NUMPY_AVAILABLE, reason='NumPy required')
36-
def test_vector_numpy(self):
37-
embedding = np.array([1.5, 2, 3])
38-
conn.run('INSERT INTO pg8000_items (embedding) VALUES (:embedding), (NULL)', embedding=embedding)
39-
40-
res = conn.run('SELECT embedding FROM pg8000_items ORDER BY id')
41-
assert res[0][0] == Vector([1.5, 2, 3])
42-
assert res[1][0] is None
34+
assert res[1][0] == Vector(embedding2)
35+
assert res[2][0] is None
4336

4437
def test_halfvec(self):
4538
embedding = HalfVector([1.5, 2, 3])

0 commit comments

Comments
 (0)