提交 ab859eff 编写于 作者: T ThreadDao 提交者: yefu.chen

Fix insert and add index

Signed-off-by: NThreadDao <yufen.zong@zilliz.com>
上级 4b0210d7
...@@ -746,7 +746,6 @@ class TestInsertAsync: ...@@ -746,7 +746,6 @@ class TestInsertAsync:
stats = connect.get_collection_stats(collection) stats = connect.get_collection_stats(collection)
assert stats[row_count] == 0 assert stats[row_count] == 0
# #1339
@pytest.mark.tags("0331") @pytest.mark.tags("0331")
def test_insert_async_invalid_params(self, connect): def test_insert_async_invalid_params(self, connect):
''' '''
...@@ -770,6 +769,7 @@ class TestInsertAsync: ...@@ -770,6 +769,7 @@ class TestInsertAsync:
''' '''
entities = [] entities = []
future = connect.insert(collection, entities, _async=True) future = connect.insert(collection, entities, _async=True)
future.done()
with pytest.raises(Exception) as e: with pytest.raises(Exception) as e:
future.result() future.result()
...@@ -1128,12 +1128,11 @@ class TestInsertInvalidBinary(object): ...@@ -1128,12 +1128,11 @@ class TestInsertInvalidBinary(object):
connect.insert(binary_collection, tmp_entity) connect.insert(binary_collection, tmp_entity)
@pytest.mark.level(2) @pytest.mark.level(2)
# #1352 @pytest.mark.tags("0331")
@pytest.mark.tags("fail")
def test_insert_with_invalid_field_entity_value(self, connect, binary_collection, get_field_vectors_value): def test_insert_with_invalid_field_entity_value(self, connect, binary_collection, get_field_vectors_value):
tmp_entity = copy.deepcopy(default_binary_entity) tmp_entity = copy.deepcopy(default_binary_entity)
src_vectors = tmp_entity[-1]["values"] 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): with pytest.raises(Exception):
connect.insert(binary_collection, tmp_entity) connect.insert(binary_collection, tmp_entity)
...@@ -1160,7 +1159,6 @@ class TestInsertInvalidBinary(object): ...@@ -1160,7 +1159,6 @@ class TestInsertInvalidBinary(object):
@pytest.mark.level(2) @pytest.mark.level(2)
@pytest.mark.tags("0331") @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): def test_insert_with_invalid_field_entities_value(self, connect, binary_collection, get_field_vectors_value):
tmp_entities = copy.deepcopy(default_binary_entities) tmp_entities = copy.deepcopy(default_binary_entities)
src_vector = tmp_entities[-1]["values"] src_vector = tmp_entities[-1]["values"]
......
...@@ -557,6 +557,13 @@ class TestIndexBase: ...@@ -557,6 +557,13 @@ class TestIndexBase:
connect.create_index(collection, field_name, get_simple_index) connect.create_index(collection, field_name, get_simple_index)
connect.drop_index(collection, field_name) 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: class TestIndexBinary:
@pytest.fixture( @pytest.fixture(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册