Code Duplication    Length = 21-22 lines in 3 locations

tests/milvus_python_test/test_index.py 3 locations

@@ 558-579 (lines=22) @@
555
        assert result._collection_name == collection
556
        assert result._index_type == IndexType.FLAT
557
558
    @pytest.mark.level(2)
559
    def test_drop_index_repeatly(self, connect, collection, get_simple_index):
560
        '''
561
        target: test drop index repeatly
562
        method: create index, call drop index, and drop again
563
        expected: return code 0
564
        '''
565
        index_param = get_simple_index["index_param"]
566
        index_type = get_simple_index["index_type"]
567
        # status, ids = connect.insert(collection, vectors)
568
        status = connect.create_index(collection, index_type, index_param)
569
        assert status.OK()
570
        status, result = connect.get_index_info(collection)
571
        logging.getLogger().info(result)
572
        status = connect.drop_index(collection)
573
        assert status.OK()
574
        status = connect.drop_index(collection)
575
        assert status.OK()
576
        status, result = connect.get_index_info(collection)
577
        logging.getLogger().info(result)
578
        assert result._collection_name == collection
579
        assert result._index_type == IndexType.FLAT
580
581
    # @pytest.mark.level(2)
582
    # def test_drop_index_without_connect(self, dis_connect, collection):
@@ 626-646 (lines=21) @@
623
        logging.getLogger().info(status)
624
        assert status.OK()
625
626
    @pytest.mark.level(2)
627
    def test_create_drop_index_repeatly(self, connect, collection, get_simple_index):
628
        '''
629
        target: test create / drop index repeatly, use the same index params
630
        method: create index, drop index, four times
631
        expected: return code 0
632
        '''
633
        index_param = get_simple_index["index_param"]
634
        index_type = get_simple_index["index_type"]
635
        # status, ids = connect.insert(collection, vectors)
636
        for i in range(2):
637
            status = connect.create_index(collection, index_type, index_param)
638
            assert status.OK()
639
            status, result = connect.get_index_info(collection)
640
            logging.getLogger().info(result)
641
            status = connect.drop_index(collection)
642
            assert status.OK()
643
            status, result = connect.get_index_info(collection)
644
            logging.getLogger().info(result)
645
            assert result._collection_name == collection
646
            assert result._index_type == IndexType.FLAT
647
648
    def test_create_drop_index_repeatly_different_index_params(self, connect, collection):
649
        '''
@@ 1179-1199 (lines=21) @@
1176
        logging.getLogger().info(status)
1177
        assert status.OK()
1178
1179
    @pytest.mark.level(2)
1180
    def test_create_drop_index_repeatly(self, connect, ip_collection, get_simple_index):
1181
        '''
1182
        target: test create / drop index repeatly, use the same index params
1183
        method: create index, drop index, four times
1184
        expected: return code 0
1185
        '''
1186
        index_param = get_simple_index["index_param"]
1187
        index_type = get_simple_index["index_type"]
1188
        status, ids = connect.insert(ip_collection, vectors)
1189
        for i in range(2):
1190
            status = connect.create_index(ip_collection, index_type, index_param)
1191
            assert status.OK()
1192
            status, result = connect.get_index_info(ip_collection)
1193
            logging.getLogger().info(result)
1194
            status = connect.drop_index(ip_collection)
1195
            assert status.OK()
1196
            status, result = connect.get_index_info(ip_collection)
1197
            logging.getLogger().info(result)
1198
            assert result._collection_name == ip_collection
1199
            assert result._index_type == IndexType.FLAT
1200
1201
    def test_create_drop_index_repeatly_different_index_params(self, connect, ip_collection):
1202
        '''