Code Duplication    Length = 36-38 lines in 2 locations

tests/milvus_python_test/test_index.py 2 locations

@@ 447-484 (lines=38) @@
444
            assert result._collection_name == collection
445
            assert result._index_type == index_type
446
447
    def test_describe_and_drop_index_multi_collections(self, connect, get_simple_index):
448
        '''
449
        target: test create, describe and drop index interface with multiple collections of L2
450
        method: create collections and add vectors in it, create index, call describe index
451
        expected: return code 0, and index instructure
452
        '''
453
        nq = 100
454
        vectors = gen_vectors(nq, dim)
455
        collection_list = []
456
        for i in range(10):
457
            collection_name = gen_unique_str()
458
            collection_list.append(collection_name)
459
            param = {'collection_name': collection_name,
460
                     'dimension': dim,
461
                     'index_file_size': index_file_size,
462
                     'metric_type': MetricType.L2}
463
            connect.create_collection(param)
464
            index_param = get_simple_index["index_param"]
465
            index_type = get_simple_index["index_type"]
466
            logging.getLogger().info(get_simple_index)
467
            status, ids = connect.insert(collection_name=collection_name, records=vectors)
468
            status = connect.create_index(collection_name, index_type, index_param)
469
            assert status.OK()
470
471
        for i in range(10):
472
            status, result = connect.get_index_info(collection_list[i])
473
            logging.getLogger().info(result)
474
            assert result._params == index_param
475
            assert result._collection_name == collection_list[i]
476
            assert result._index_type == index_type
477
478
        for i in range(10):
479
            status = connect.drop_index(collection_list[i])
480
            assert status.OK()
481
            status, result = connect.get_index_info(collection_list[i])
482
            logging.getLogger().info(result)
483
            assert result._collection_name == collection_list[i]
484
            assert result._index_type == IndexType.FLAT
485
486
    # @pytest.mark.level(2)
487
    # def test_get_index_info_without_connect(self, dis_connect, collection):
@@ 988-1023 (lines=36) @@
985
        assert result._collection_name == ip_collection
986
        assert result._index_type == index_type
987
988
    def test_describe_and_drop_index_multi_collections(self, connect, get_simple_index):
989
        '''
990
        target: test create, describe and drop index interface with multiple collections of IP
991
        method: create collections and add vectors in it, create index, call describe index
992
        expected: return code 0, and index instructure
993
        '''
994
        nq = 100
995
        vectors = gen_vectors(nq, dim)
996
        collection_list = []
997
        for i in range(10):
998
            collection_name = gen_unique_str()
999
            collection_list.append(collection_name)
1000
            param = {'collection_name': collection_name,
1001
                     'dimension': dim,
1002
                     'index_file_size': index_file_size,
1003
                     'metric_type': MetricType.IP}
1004
            connect.create_collection(param)
1005
            index_param = get_simple_index["index_param"]
1006
            index_type = get_simple_index["index_type"]
1007
            logging.getLogger().info(get_simple_index)
1008
            status, ids = connect.insert(collection_name=collection_name, records=vectors)
1009
            status = connect.create_index(collection_name, index_type, index_param)
1010
            assert status.OK()
1011
        for i in range(10):
1012
            status, result = connect.get_index_info(collection_list[i])
1013
            logging.getLogger().info(result)
1014
            assert result._params == index_param
1015
            assert result._collection_name == collection_list[i]
1016
            assert result._index_type == index_type
1017
        for i in range(10):
1018
            status = connect.drop_index(collection_list[i])
1019
            assert status.OK()
1020
            status, result = connect.get_index_info(collection_list[i])
1021
            logging.getLogger().info(result)
1022
            assert result._collection_name == collection_list[i]
1023
            assert result._index_type == IndexType.FLAT
1024
1025
    # @pytest.mark.level(2)
1026
    # def test_get_index_info_without_connect(self, dis_connect, ip_collection):