MCPcopy Create free account
hub / github.com/MinishLab/vicinity / test_vicinity_insert_mismatched_lengths

Function test_vicinity_insert_mismatched_lengths

tests/test_vicinity.py:258–269  ·  view source on GitHub ↗

Test that Vicinity.insert raises ValueError when tokens and vectors lengths do not match. :param vicinity_instance: A Vicinity instance. :raises ValueError: If tokens and vectors lengths differ.

(vicinity_instance: Vicinity, query_vector: np.ndarray)

Source from the content-addressed store, hash-verified

256
257
258def test_vicinity_insert_mismatched_lengths(vicinity_instance: Vicinity, query_vector: np.ndarray) -> None:
259 """
260 Test that Vicinity.insert raises ValueError when tokens and vectors lengths do not match.
261
262 :param vicinity_instance: A Vicinity instance.
263 :raises ValueError: If tokens and vectors lengths differ.
264 """
265 new_items = ["item10002", "item10003"]
266 new_vector = query_vector
267
268 with pytest.raises(ValueError):
269 vicinity_instance.insert(new_items, new_vector[None, :])
270
271
272def test_vicinity_insert_wrong_dimension(vicinity_instance: Vicinity) -> None:

Callers

nothing calls this directly

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…