diff --git a/tests/milvus_python_test/test_index.py b/tests/milvus_python_test/test_index.py index 39aadb9d33..b253cf02a3 100644 --- a/tests/milvus_python_test/test_index.py +++ b/tests/milvus_python_test/test_index.py @@ -1208,9 +1208,9 @@ class TestCreateIndexParamsInvalid(object): nlist = index_params["nlist"] logging.getLogger().info(index_params) status, ids = connect.add_vectors(table, vectors) - # if not isinstance(index_type, int) or not isinstance(nlist, int): - with pytest.raises(Exception) as e: + if (not index_type) or (not nlist) or (not isinstance(index_type, IndexType)) or (not isinstance(nlist, int)): + with pytest.raises(Exception) as e: + status = connect.create_index(table, index_params) + else: status = connect.create_index(table, index_params) - # else: - # status = connect.create_index(table, index_params) - # assert not status.OK() + assert not status.OK() diff --git a/tests/milvus_python_test/utils.py b/tests/milvus_python_test/utils.py index 159c8407c6..1686ad7129 100644 --- a/tests/milvus_python_test/utils.py +++ b/tests/milvus_python_test/utils.py @@ -54,12 +54,12 @@ def gen_long_str(num): def gen_invalid_ips(): ips = [ - "255.0.0.0", - "255.255.0.0", - "255.255.255.0", - "255.255.255.255", + # "255.0.0.0", + # "255.255.0.0", + # "255.255.255.0", + # "255.255.255.255", "127.0.0", - "123.0.0.2", + # "123.0.0.2", "12-s", " ", "12 s", @@ -114,12 +114,12 @@ def gen_invalid_uris(): # invalid ip "tcp:// :%s" % port, - "tcp://123.0.0.1:%s" % port, + # "tcp://123.0.0.1:%s" % port, "tcp://127.0.0:%s" % port, "tcp://255.0.0.0:%s" % port, - "tcp://255.255.0.0:%s" % port, - "tcp://255.255.255.0:%s" % port, - "tcp://255.255.255.255:%s" % port, + # "tcp://255.255.0.0:%s" % port, + # "tcp://255.255.255.0:%s" % port, + # "tcp://255.255.255.255:%s" % port, "tcp://\n:%s" % port, ] @@ -263,9 +263,7 @@ def gen_invalid_index_types(): def gen_invalid_nlists(): nlists = [ - 0, -1, - 1000000000000001, # None, [1,2,3], (1,2), @@ -549,4 +547,4 @@ if __name__ == "__main__": p.join() time.sleep(3) status, count = milvus.get_table_row_count(table) - assert count == process_num * loop_num \ No newline at end of file + assert count == process_num * loop_num