Code Duplication    Length = 24-28 lines in 2 locations

tests/milvus_python_test/test_index.py 2 locations

@@ 1123-1150 (lines=28) @@
1120
        assert result._collection_name == ip_collection
1121
        assert result._index_type == IndexType.FLAT
1122
1123
    @pytest.mark.level(2)
1124
    def test_drop_index_repeatly(self, connect, ip_collection, get_simple_index):
1125
        '''
1126
        target: test drop index repeatly
1127
        method: create index, call drop index, and drop again
1128
        expected: return code 0
1129
        '''
1130
        index_param = get_simple_index["index_param"]
1131
        index_type = get_simple_index["index_type"]
1132
        # status, ids = connect.insert(ip_collection, vectors)
1133
        status, mode = connect._cmd("mode")
1134
        assert status.OK()
1135
        # status, ids = connect.insert(ip_collection, vectors)
1136
        status = connect.create_index(ip_collection, index_type, index_param)
1137
        if str(mode) == "GPU" and (index_type == IndexType.IVF_PQ):
1138
            assert not status.OK()
1139
        else:
1140
            assert status.OK()        
1141
        status, result = connect.get_index_info(ip_collection)
1142
        logging.getLogger().info(result)
1143
        status = connect.drop_index(ip_collection)
1144
        assert status.OK()
1145
        status = connect.drop_index(ip_collection)
1146
        assert status.OK()
1147
        status, result = connect.get_index_info(ip_collection)
1148
        logging.getLogger().info(result)
1149
        assert result._collection_name == ip_collection
1150
        assert result._index_type == IndexType.FLAT
1151
1152
    # @pytest.mark.level(2)
1153
    # def test_drop_index_without_connect(self, dis_connect, ip_collection):
@@ 1056-1079 (lines=24) @@
1053
    ******************************************************************
1054
    """
1055
1056
    def test_drop_index(self, connect, ip_collection, get_simple_index):
1057
        '''
1058
        target: test drop index interface
1059
        method: create collection and add vectors in it, create index, call drop index
1060
        expected: return code 0, and default index param
1061
        '''
1062
        index_param = get_simple_index["index_param"]
1063
        index_type = get_simple_index["index_type"]
1064
        status, mode = connect._cmd("mode")
1065
        assert status.OK()
1066
        # status, ids = connect.insert(ip_collection, vectors)
1067
        status = connect.create_index(ip_collection, index_type, index_param)
1068
        if str(mode) == "GPU" and (index_type == IndexType.IVF_PQ):
1069
            assert not status.OK()
1070
        else:
1071
            assert status.OK()
1072
        status, result = connect.get_index_info(ip_collection)
1073
        logging.getLogger().info(result)
1074
        status = connect.drop_index(ip_collection)
1075
        assert status.OK()
1076
        status, result = connect.get_index_info(ip_collection)
1077
        logging.getLogger().info(result)
1078
        assert result._collection_name == ip_collection
1079
        assert result._index_type == IndexType.FLAT
1080
1081
    def test_drop_index_partition(self, connect, ip_collection, get_simple_index):
1082
        '''