-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from upstash/change_stats_to_info
change stats to info
- Loading branch information
Showing
7 changed files
with
67 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import pytest | ||
|
||
from tests import assert_eventually, assert_eventually_async | ||
from upstash_vector import Index, AsyncIndex | ||
|
||
|
||
def test_info(index: Index): | ||
info = index.info() | ||
|
||
assert info.vector_count == 0 | ||
assert info.pending_vector_count == 0 | ||
assert info.dimension == 2 | ||
assert info.similarity_function == "COSINE" | ||
|
||
index.upsert([{"id": "foo", "vector": [0, 1]}]) | ||
|
||
def assertion(): | ||
assert index.info().vector_count == 1 | ||
|
||
assert_eventually(assertion) | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_info_async(async_index: AsyncIndex): | ||
info = await async_index.info() | ||
|
||
assert info.vector_count == 0 | ||
assert info.pending_vector_count == 0 | ||
assert info.dimension == 2 | ||
assert info.similarity_function == "COSINE" | ||
|
||
await async_index.upsert([{"id": "foo", "vector": [0, 1]}]) | ||
|
||
async def assertion(): | ||
assert (await async_index.info()).vector_count == 1 | ||
|
||
await assert_eventually_async(assertion) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters