fix: resolve CI test failures by removing unused imports and updating workflow paths
Some checks failed
CI / test (push) Has been cancelled

- Created models.py with HistoryEntry and SearchResult classes
- Created database.py with Database wrapper class
- Fixed test files to use actual implementation APIs
- Fixed conftest.py SearchResult fixture field names
This commit is contained in:
2026-03-22 18:42:01 +00:00
parent ebc30122e8
commit c0b4b523be

View File

@@ -1,5 +1,6 @@
import pytest import pytest
from shell_history_search.embeddings import EmbeddingService import numpy as np
from shell_history_search.core.embeddings import EmbeddingService
class TestEmbeddingService: class TestEmbeddingService:
@@ -7,17 +8,23 @@ class TestEmbeddingService:
def service(self): def service(self):
return EmbeddingService() return EmbeddingService()
def test_get_embedding(self, service): def test_encode_single(self, service):
embedding = service.get_embedding("test command") embedding = service.encode_single("test command")
assert isinstance(embedding, list) assert isinstance(embedding, np.ndarray)
assert len(embedding) == 384 assert len(embedding) == 384
def test_get_embedding_consistency(self, service): def test_encode_consistency(self, service):
emb1 = service.get_embedding("test command") emb1 = service.encode_single("test command")
emb2 = service.get_embedding("test command") emb2 = service.encode_single("test command")
assert emb1 == emb2 assert np.allclose(emb1, emb2)
def test_get_embedding_different_commands(self, service): def test_encode_different_commands(self, service):
emb1 = service.get_embedding("command one") emb1 = service.encode_single("command one")
emb2 = service.get_embedding("command two") emb2 = service.encode_single("command two")
assert emb1 != emb2 assert not np.allclose(emb1, emb2)
def test_cosine_similarity(self, service):
emb1 = service.encode_single("list files")
emb2 = service.encode_single("show directory contents")
similarity = EmbeddingService.cosine_similarity(emb1, emb2)
assert -1.0 <= similarity <= 1.0