From ab859effad8387b0048a13651a94ed26b4b1a529 Mon Sep 17 00:00:00 2001 From: ThreadDao <yufen.zong@zilliz.com> Date: Wed, 17 Mar 2021 18:21:45 +0800 Subject: [PATCH] Fix insert and add index Signed-off-by: ThreadDao <yufen.zong@zilliz.com> --- tests/python_test/entity/test_insert.py | 8 +++----- tests/python_test/test_index.py | 7 +++++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/python_test/entity/test_insert.py b/tests/python_test/entity/test_insert.py index 0eca0581e..b8261da15 100644 --- a/tests/python_test/entity/test_insert.py +++ b/tests/python_test/entity/test_insert.py @@ -746,7 +746,6 @@ class TestInsertAsync: stats = connect.get_collection_stats(collection) assert stats[row_count] == 0 - # #1339 @pytest.mark.tags("0331") def test_insert_async_invalid_params(self, connect): ''' @@ -770,6 +769,7 @@ class TestInsertAsync: ''' entities = [] future = connect.insert(collection, entities, _async=True) + future.done() with pytest.raises(Exception) as e: future.result() @@ -1128,12 +1128,11 @@ class TestInsertInvalidBinary(object): connect.insert(binary_collection, tmp_entity) @pytest.mark.level(2) - # #1352 - @pytest.mark.tags("fail") + @pytest.mark.tags("0331") def test_insert_with_invalid_field_entity_value(self, connect, binary_collection, get_field_vectors_value): tmp_entity = copy.deepcopy(default_binary_entity) src_vectors = tmp_entity[-1]["values"] - src_vectors[0][1] = get_field_vectors_value + src_vectors[0] = get_field_vectors_value with pytest.raises(Exception): connect.insert(binary_collection, tmp_entity) @@ -1160,7 +1159,6 @@ class TestInsertInvalidBinary(object): @pytest.mark.level(2) @pytest.mark.tags("0331") - # TODO 'bytes' object does not support item assignment def test_insert_with_invalid_field_entities_value(self, connect, binary_collection, get_field_vectors_value): tmp_entities = copy.deepcopy(default_binary_entities) src_vector = tmp_entities[-1]["values"] diff --git a/tests/python_test/test_index.py b/tests/python_test/test_index.py index 2051520ac..f6cff1ba4 100644 --- a/tests/python_test/test_index.py +++ b/tests/python_test/test_index.py @@ -557,6 +557,13 @@ class TestIndexBase: connect.create_index(collection, field_name, get_simple_index) connect.drop_index(collection, field_name) + def test_create_PQ_without_nbits(self, connect, collection): + PQ_index = {"index_type": "IVF_PQ", "params": {"nlist": 128, "m": 16}, "metric_type": "L2"} + ids = connect.insert(collection, default_entities) + connect.create_index(collection, field_name, PQ_index) + index = connect.describe_index(collection, field_name) + assert index == PQ_index + class TestIndexBinary: @pytest.fixture( -- GitLab