Code Duplication    Length = 20-20 lines in 4 locations

tests/milvus_python_test/test_index.py 4 locations

@@ 1577-1596 (lines=20) @@
1574
        assert status.OK()
1575
        assert len(result) == len(query_vecs)
1576
1577
    @pytest.mark.timeout(BUILD_TIMEOUT)
1578
    def test_create_index_search_with_query_vectors_superstructure(self, connect, superstructure_collection, get_superstructure_index):
1579
        '''
1580
        target: test create index interface, search with more query vectors
1581
        method: create collection and add vectors in it, create index
1582
        expected: return code equals to 0, and search success
1583
        '''
1584
        index_param = get_superstructure_index["index_param"]
1585
        index_type = get_superstructure_index["index_type"]
1586
        logging.getLogger().info(get_superstructure_index)
1587
        status, ids = connect.insert(superstructure_collection, self.vectors)
1588
        status = connect.create_index(superstructure_collection, index_type, index_param)
1589
        logging.getLogger().info(connect.get_index_info(superstructure_collection))
1590
        query_vecs = [self.vectors[0], self.vectors[1], self.vectors[2]]
1591
        top_k = 5
1592
        search_param = get_search_param(index_type)
1593
        status, result = connect.search(superstructure_collection, top_k, query_vecs, params=search_param)
1594
        logging.getLogger().info(result)
1595
        assert status.OK()
1596
        assert len(result) == len(query_vecs)
1597
1598
    """
1599
    ******************************************************************
@@ 1556-1575 (lines=20) @@
1553
    #     with pytest.raises(Exception) as e:
1554
    #         status = dis_connect.create_index(ham_collection, IndexType.IVF_SQ8, index_param)
1555
1556
    @pytest.mark.timeout(BUILD_TIMEOUT)
1557
    def test_create_index_search_with_query_vectors(self, connect, ham_collection, get_hamming_index):
1558
        '''
1559
        target: test create index interface, search with more query vectors
1560
        method: create collection and add vectors in it, create index
1561
        expected: return code equals to 0, and search success
1562
        '''
1563
        index_param = get_hamming_index["index_param"]
1564
        index_type = get_hamming_index["index_type"]
1565
        logging.getLogger().info(get_hamming_index)
1566
        status, ids = connect.insert(ham_collection, self.vectors)
1567
        status = connect.create_index(ham_collection,  index_type, index_param)
1568
        logging.getLogger().info(connect.get_index_info(ham_collection))
1569
        query_vecs = [self.vectors[0], self.vectors[1], self.vectors[2]]
1570
        top_k = 5
1571
        search_param = get_search_param(index_type)
1572
        status, result = connect.search(ham_collection, top_k, query_vecs, params=search_param)
1573
        logging.getLogger().info(result)
1574
        assert status.OK()
1575
        assert len(result) == len(query_vecs)
1576
1577
    @pytest.mark.timeout(BUILD_TIMEOUT)
1578
    def test_create_index_search_with_query_vectors_superstructure(self, connect, superstructure_collection, get_superstructure_index):
@@ 1316-1335 (lines=20) @@
1313
    #     with pytest.raises(Exception) as e:
1314
    #         status = dis_connect.create_index(jac_collection, IndexType.IVF_SQ8, index_param)
1315
1316
    @pytest.mark.timeout(BUILD_TIMEOUT)
1317
    def test_create_index_search_with_query_vectors(self, connect, jac_collection, get_jaccard_index):
1318
        '''
1319
        target: test create index interface, search with more query vectors
1320
        method: create collection and add vectors in it, create index
1321
        expected: return code equals to 0, and search success
1322
        '''
1323
        index_param = get_jaccard_index["index_param"]
1324
        index_type = get_jaccard_index["index_type"]
1325
        logging.getLogger().info(get_jaccard_index)
1326
        status, ids = connect.insert(jac_collection, self.vectors)
1327
        status = connect.create_index(jac_collection, index_type, index_param)
1328
        logging.getLogger().info(connect.get_index_info(jac_collection))
1329
        query_vecs = [self.vectors[0], self.vectors[1], self.vectors[2]]
1330
        top_k = 5
1331
        search_param = get_search_param(index_type)
1332
        status, result = connect.search(jac_collection, top_k, query_vecs, params=search_param)
1333
        logging.getLogger().info(result)
1334
        assert status.OK()
1335
        assert len(result) == len(query_vecs)
1336
1337
    """
1338
    ******************************************************************
@@ 132-151 (lines=20) @@
129
    #     with pytest.raises(Exception) as e:
130
    #         status = dis_connect.create_index(collection, index_type, index_param)
131
132
    @pytest.mark.timeout(BUILD_TIMEOUT)
133
    def test_create_index_search_with_query_vectors(self, connect, collection, get_simple_index):
134
        '''
135
        target: test create index interface, search with more query vectors
136
        method: create collection and add vectors in it, create index
137
        expected: return code equals to 0, and search success
138
        '''
139
        index_param = get_simple_index["index_param"]
140
        index_type = get_simple_index["index_type"]
141
        logging.getLogger().info(get_simple_index)
142
        status, ids = connect.insert(collection, vectors)
143
        status = connect.create_index(collection, index_type, index_param)
144
        logging.getLogger().info(connect.get_index_info(collection))
145
        query_vecs = [vectors[0], vectors[1], vectors[2]]
146
        top_k = 5
147
        search_param = get_search_param(index_type)
148
        status, result = connect.search(collection, top_k, query_vecs, params=search_param)
149
        assert status.OK()
150
        assert len(result) == len(query_vecs)
151
        logging.getLogger().info(result)
152
153
    @pytest.mark.timeout(BUILD_TIMEOUT)
154
    @pytest.mark.level(2)