MCPcopy Create free account
hub / github.com/alibaba/zvec / test_properties

Method test_properties

python/tests/test_embedding.py:2022–2046  ·  view source on GitHub ↗

Test property accessors.

(self)

Source from the content-addressed store, hash-verified

2020 assert all(v > 0 for v in result.values())
2021
2022 def test_properties(self):
2023 """Test property accessors."""
2024 corpus = ["doc1", "doc2", "doc3"]
2025
2026 with patch(
2027 "zvec.extension.bm25_embedding_function.require_module"
2028 ) as mock_require:
2029 mock_dashtext = Mock()
2030 mock_encoder = Mock()
2031 mock_dashtext.SparseVectorEncoder.return_value = mock_encoder
2032 mock_require.return_value = mock_dashtext
2033
2034 bm25 = BM25EmbeddingFunction(
2035 corpus=corpus,
2036 encoding_type="document",
2037 language="en",
2038 b=0.8,
2039 k1=1.5,
2040 custom_param="test",
2041 )
2042
2043 assert bm25.corpus_size == 3
2044 assert bm25.encoding_type == "document"
2045 assert bm25.language == "en"
2046 assert bm25.extra_params == {"custom_param": "test"}
2047
2048 @pytest.mark.skipif(
2049 not RUN_INTEGRATION_TESTS,

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected