From b601d20a3b7bc00b65ee131274ba36ecfc2937ce Mon Sep 17 00:00:00 2001 From: Julian Nguyen <109386615+juliannguyen4@users.noreply.github.com> Date: Tue, 3 Mar 2026 14:28:12 -0800 Subject: [PATCH 1/8] Replace all deprecated usages of index_cdt_create(). We want to check that the new usage works throughout the tests. Move negative deprecated API tests to the right class. Check that index_cdt_create() raises a warning --- test/new_tests/test_cdt_index.py | 170 ++++++++---------------- test/new_tests/test_index_deprecated.py | 31 +++++ 2 files changed, 87 insertions(+), 114 deletions(-) diff --git a/test/new_tests/test_cdt_index.py b/test/new_tests/test_cdt_index.py index b894b3d647..b7166ecdf1 100644 --- a/test/new_tests/test_cdt_index.py +++ b/test/new_tests/test_cdt_index.py @@ -96,15 +96,14 @@ def test_pos_cdtindex_with_correct_parameters(self): Invoke index_cdt_create() with correct arguments """ policy = {} - retobj = self.as_connection.index_cdt_create( + retobj = self.as_connection.index_list_create( "test", "demo", "string_list", - aerospike.INDEX_TYPE_LIST, aerospike.INDEX_STRING, "test_string_list_cdt_index", - ctx_list_index, policy, + ctx_list_index ) self.as_connection.index_remove("test", "test_string_list_cdt_index", policy) @@ -141,15 +140,14 @@ def test_pos_cdtindex_with_listrank_correct_parameters(self): Invoke index_cdt_create() with correct arguments """ policy = {} - retobj = self.as_connection.index_cdt_create( + retobj = self.as_connection.index_list_create( "test", "demo", "string_list", - aerospike.INDEX_TYPE_LIST, aerospike.INDEX_STRING, "test_string_list_cdt_index", - ctx_list_rank, policy, + ctx_list_rank ) self.as_connection.index_remove("test", "test_string_list_cdt_index", policy) @@ -162,15 +160,14 @@ def test_pos_cdtindex_with_listvalue_correct_parameters(self): Invoke index_cdt_create() with correct arguments """ policy = {} - retobj = self.as_connection.index_cdt_create( + retobj = self.as_connection.index_list_create( "test", "demo", "string_list", - aerospike.INDEX_TYPE_LIST, aerospike.INDEX_STRING, "test_string_list_cdt_index", - ctx_list_value, policy, + ctx_list_value ) self.as_connection.index_remove("test", "test_string_list_cdt_index", policy) @@ -183,15 +180,14 @@ def test_pos_cdtindex_with_mapindex_correct_parameters(self): Invoke index_cdt_create() with correct arguments """ policy = {} - retobj = self.as_connection.index_cdt_create( + retobj = self.as_connection.index_map_keys_create( "test", "demo", "string_list", - aerospike.INDEX_TYPE_MAPKEYS, aerospike.INDEX_STRING, "test_string_list_cdt_index", - ctx_map_index, policy, + ctx_map_index ) self.as_connection.index_remove("test", "test_string_list_cdt_index", policy) @@ -204,15 +200,14 @@ def test_pos_cdtindex_with_mapvalue_correct_parameters(self): Invoke index_cdt_create() with correct arguments """ policy = {} - retobj = self.as_connection.index_cdt_create( + retobj = self.as_connection.index_map_values_create( "test", "demo", "string_list", - aerospike.INDEX_TYPE_MAPVALUES, aerospike.INDEX_STRING, "test_string_list_cdt_index", - ctx_map_value, policy, + ctx_map_value ) self.as_connection.index_remove("test", "test_string_list_cdt_index", policy) @@ -225,15 +220,14 @@ def test_pos_cdtindex_with_maprankvalue_correct_parameters(self): Invoke index_cdt_create() with correct arguments """ policy = {} - retobj = self.as_connection.index_cdt_create( + retobj = self.as_connection.index_map_values_create( "test", "demo", "string_list", - aerospike.INDEX_TYPE_MAPVALUES, aerospike.INDEX_STRING, "test_string_list_cdt_index", - ctx_map_rank, policy, + ctx_map_rank ) self.as_connection.index_remove("test", "test_string_list_cdt_index", policy) @@ -247,15 +241,14 @@ def test_pos_cdtindex_with_correct_parameters1(self): Invoke index_cdt_create() with correct arguments """ policy = {} - retobj = self.as_connection.index_cdt_create( + retobj = self.as_connection.index_map_values_create( "test", "demo", "string_list", - aerospike.INDEX_TYPE_MAPVALUES, aerospike.INDEX_STRING, "test_string_list_cdt_index", - ctx_map_rank, policy, + ctx_map_rank ) self.as_connection.index_remove("test", "test_string_list_cdt_index", policy) @@ -268,15 +261,14 @@ def test_pos_cdtindex_with_correct_parameters_numeric(self): Invoke index_cdt_create() with correct arguments """ policy = {} - retobj = self.as_connection.index_cdt_create( + retobj = self.as_connection.index_list_create( "test", "demo", "numeric_list", - aerospike.INDEX_TYPE_LIST, aerospike.INDEX_NUMERIC, "test_numeric_list_cdt_index", - ctx_list_index, policy, + ctx_list_index ) assert retobj == 0 @@ -291,15 +283,14 @@ def test_pos_cdtindex_with_correct_parameters_set_length_extra(self): set_name = set_name + "a" policy = {} try: - self.as_connection.index_cdt_create( + self.as_connection.index_list_create( "test", set_name, "string_list", - aerospike.INDEX_TYPE_LIST, aerospike.INDEX_STRING, "test_string_list_cdt_index", - ctx_list_index, policy, + ctx_list_index ) assert False except e.InvalidRequest as exception: @@ -312,15 +303,14 @@ def test_pos_cdtindex_with_incorrect_bin(self): Invoke createindex() with incorrect bin """ policy = {} - retobj = self.as_connection.index_cdt_create( + retobj = self.as_connection.index_list_create( "test", "demo", "string_list1", - aerospike.INDEX_TYPE_LIST, aerospike.INDEX_STRING, "test_string_list_cdt_index", - ctx_list_index, policy, + ctx_list_index ) assert retobj == 0 @@ -332,27 +322,25 @@ def test_pos_create_same_cdtindex_multiple_times(self): Invoke createindex() with multiple times on same bin """ policy = {} - retobj = self.as_connection.index_cdt_create( + retobj = self.as_connection.index_list_create( "test", "demo", "numeric_list", - aerospike.INDEX_TYPE_LIST, aerospike.INDEX_NUMERIC, "test_numeric_list_cdt_index", - ctx_list_index, policy, + ctx_list_index ) if retobj == 0: try: - self.as_connection.index_cdt_create( + self.as_connection.index_list_create( "test", "demo", "numeric_list", - aerospike.INDEX_TYPE_LIST, aerospike.INDEX_NUMERIC, "test_numeric_list_cdt_index", - ctx_list_index, policy, + ctx_list_index ) except e.IndexFoundError: assert self.server_version < [6, 1] @@ -366,27 +354,25 @@ def test_pos_create_same_cdtindex_multiple_times_different_bin(self): Invoke createindex() with multiple times on different bin """ policy = {} - retobj = self.as_connection.index_cdt_create( + retobj = self.as_connection.index_list_create( "test", "demo", "string_list", - aerospike.INDEX_TYPE_LIST, aerospike.INDEX_STRING, "test_string_list_cdt_index", - ctx_list_index, policy, + ctx_list_index ) if retobj == 0: with pytest.raises(e.IndexFoundError): - retobj = self.as_connection.index_cdt_create( + retobj = self.as_connection.index_list_create( "test", "demo", "numeric_list", - aerospike.INDEX_TYPE_LIST, aerospike.INDEX_NUMERIC, "test_string_list_cdt_index", - ctx_list_index, policy, + ctx_list_index ) self.as_connection.index_remove("test", "test_string_list_cdt_index", policy) ensure_dropped_index(self.as_connection, "test", "test_string_list_cdt_index") @@ -402,27 +388,25 @@ def test_pos_create_different_cdtindex_multiple_times_same_bin(self): name """ policy = {} - retobj = self.as_connection.index_cdt_create( + retobj = self.as_connection.index_list_create( "test", "demo", "string_list", - aerospike.INDEX_TYPE_LIST, aerospike.INDEX_STRING, "test_string_list_cdt_index", - ctx_list_index, policy, + ctx_list_index ) if retobj == 0: try: - retobj = self.as_connection.index_cdt_create( + retobj = self.as_connection.index_list_create( "test", "demo", "string_list", - aerospike.INDEX_TYPE_LIST, aerospike.INDEX_STRING, "test_string_list_cdt_index1", - ctx_list_index, policy, + ctx_list_index ) except e.IndexFoundError: assert self.server_version < [6, 1] @@ -437,15 +421,14 @@ def test_pos_createcdtindex_with_policy(self): Invoke createindex() with policy """ policy = {"timeout": 10000} - retobj = self.as_connection.index_cdt_create( + retobj = self.as_connection.index_list_create( "test", "demo", "num_list_pol", - aerospike.INDEX_TYPE_LIST, aerospike.INDEX_NUMERIC, "test_numeric_list_cdt_index_pol", - ctx_list_index, policy, + ctx_list_index ) assert retobj == 0 @@ -457,15 +440,14 @@ def test_pos_createcdtindex_with_policystring(self): Invoke createindex() with policy """ policy = {"timeout": 10000} - retobj = self.as_connection.index_cdt_create( + retobj = self.as_connection.index_list_create( "test", "demo", "string_list", - aerospike.INDEX_TYPE_LIST, aerospike.INDEX_STRING, "test_string_list_cdt_index", - ctx_list_index, policy, + ctx_list_index ) assert retobj == 0 @@ -494,15 +476,14 @@ def test_pos_create_liststringindex_unicode_positive(self): Invoke create string index() with correct arguments """ policy = {} - retobj = self.as_connection.index_cdt_create( + retobj = self.as_connection.index_list_create( "test", "demo", "string_list", - aerospike.INDEX_TYPE_LIST, aerospike.INDEX_STRING, "uni_name_index", - ctx_list_index, policy, + ctx_list_index ) assert retobj == 0 @@ -514,15 +495,14 @@ def test_pos_create_list_integer_index_unicode(self): Invoke createindex() with correct arguments """ policy = {} - retobj = self.as_connection.index_cdt_create( + retobj = self.as_connection.index_list_create( "test", "demo", "numeric_list", - aerospike.INDEX_TYPE_LIST, aerospike.INDEX_NUMERIC, "uni_age_index", - ctx_list_index, policy, + ctx_list_index ) assert retobj == 0 @@ -550,15 +530,14 @@ def test_neg_cdtindex_with_namespace_is_none(self): """ policy = {} try: - self.as_connection.index_cdt_create( + self.as_connection.index_list_create( None, "demo", "string_list", - aerospike.INDEX_TYPE_LIST, aerospike.INDEX_STRING, "test_string_list_cdt_index", - ctx_list_index, policy, + ctx_list_index ) except e.ParamError as exception: @@ -571,15 +550,14 @@ def test_neg_cdtindex_with_set_is_int(self): """ policy = {} try: - self.as_connection.index_cdt_create( + self.as_connection.index_list_create( "test", 1, "string_list", - aerospike.INDEX_TYPE_LIST, aerospike.INDEX_STRING, "test_string_list_cdt_index", - ctx_list_index, policy, + ctx_list_index ) assert False except e.ParamError as exception: @@ -594,15 +572,14 @@ def test_neg_cdtindex_with_set_is_none(self): """ policy = {} try: - self.as_connection.index_cdt_create( + self.as_connection.index_list_create( "test", None, "string_list", - aerospike.INDEX_TYPE_LIST, aerospike.INDEX_STRING, "test_string_list_cdt_index", - ctx_list_index, policy, + ctx_list_index ) except e.ParamError as exception: @@ -617,15 +594,14 @@ def test_neg_cdtindex_with_bin_is_none(self): """ policy = {} try: - self.as_connection.index_cdt_create( + self.as_connection.index_list_create( "test", "demo", None, - aerospike.INDEX_TYPE_LIST, aerospike.INDEX_NUMERIC, "test_numeric_list_cdt_index", - ctx_list_index, policy, + ctx_list_index ) except e.ParamError as exception: @@ -638,15 +614,14 @@ def test_neg_cdtindex_with_index_is_none(self): """ policy = {} try: - self.as_connection.index_cdt_create( + self.as_connection.index_list_create( "test", "demo", "string_list", - aerospike.INDEX_TYPE_LIST, aerospike.INDEX_STRING, None, - ctx_list_index, policy, + ctx_list_index ) except e.ParamError as exception: @@ -660,15 +635,14 @@ def test_neg_cdtindex_with_incorrect_namespace(self): policy = {} try: - self.as_connection.index_cdt_create( + self.as_connection.index_single_value_create( "test1", "demo", "numeric_list", - aerospike.INDEX_TYPE_DEFAULT, aerospike.INDEX_NUMERIC, "test_numeric_list_cdt_index", - ctx_list_index, policy, + ctx_list_index ) except e.NamespaceNotFound as exception: @@ -679,15 +653,14 @@ def test_neg_cdtindex_with_incorrect_set(self): Invoke createindex() with incorrect set """ policy = {} - retobj = self.as_connection.index_cdt_create( + retobj = self.as_connection.index_list_create( "test", "demo1", "numeric_list", - aerospike.INDEX_TYPE_LIST, aerospike.INDEX_NUMERIC, "test_numeric_list_cdt_index", - ctx_list_index, policy, + ctx_list_index ) assert retobj == 0 @@ -704,46 +677,15 @@ def test_neg_cdtindex_with_correct_parameters_no_connection(self): client1.close() try: - client1.index_cdt_create( + client1.index_list_create( "test", "demo", "string_list", - aerospike.INDEX_TYPE_LIST, aerospike.INDEX_STRING, "test_string_list_cdt_index", - ctx_list_index, policy, + ctx_list_index ) except e.ClusterError as exception: assert exception.code == 11 - - def test_neg_cdtindex_with_no_paramters(self): - """ - Invoke index_cdt_create() without any mandatory parameters. - """ - with pytest.raises(TypeError) as typeError: - self.as_connection.index_cdt_create() - - assert "argument 'ns' (pos 1)" in str(typeError.value) - - @pytest.mark.parametrize( - "ctx", - [ - None, - # Invalid type - {"ctx": 1} - ] - ) - def test_neg_cdtindex_with_invalid_ctx(self, ctx): - with pytest.raises(e.ParamError): - self.as_connection.index_cdt_create( - "test", - "demo", - "string_list", - aerospike.INDEX_TYPE_LIST, - aerospike.INDEX_STRING, - "test_string_list_cdt_index", - # Ctx must be a list - ctx - ) diff --git a/test/new_tests/test_index_deprecated.py b/test/new_tests/test_index_deprecated.py index a5de8d5aac..0376a0b188 100644 --- a/test/new_tests/test_index_deprecated.py +++ b/test/new_tests/test_index_deprecated.py @@ -13,6 +13,7 @@ class TestDeprecatedIndexCreationMethods: aerospike.Client.index_integer_create, aerospike.Client.index_string_create, aerospike.Client.index_geo2dsphere_create, + aerospike.Client.index_cdt_create, ] ) def test_deprecated_index_creation_methods(self, index_create_method): @@ -21,3 +22,33 @@ def test_deprecated_index_creation_methods(self, index_create_method): with pytest.raises(e.ParamError): index_create_method(self.as_connection, 1, "demo", "bin_name", "deprecated_index") assert len(w) == 1 + + def test_neg_cdtindex_with_no_paramters(self): + """ + Invoke index_cdt_create() without any mandatory parameters. + """ + with pytest.raises(TypeError) as typeError: + self.as_connection.index_cdt_create() + + assert "argument 'ns' (pos 1)" in str(typeError.value) + + @pytest.mark.parametrize( + "ctx", + [ + None, + # Invalid type + {"ctx": 1} + ] + ) + def test_neg_cdtindex_with_invalid_ctx(self, ctx): + with pytest.raises(e.ParamError): + self.as_connection.index_cdt_create( + "test", + "demo", + "string_list", + aerospike.INDEX_TYPE_LIST, + aerospike.INDEX_STRING, + "test_string_list_cdt_index", + # Ctx must be a list + ctx + ) From b64448043558f6f66331f9014cd2ec8029e97652 Mon Sep 17 00:00:00 2001 From: Julian Nguyen <109386615+juliannguyen4@users.noreply.github.com> Date: Tue, 3 Mar 2026 14:49:32 -0800 Subject: [PATCH 2/8] Fix test case --- test/new_tests/test_index_deprecated.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/new_tests/test_index_deprecated.py b/test/new_tests/test_index_deprecated.py index 0376a0b188..8a3234cb22 100644 --- a/test/new_tests/test_index_deprecated.py +++ b/test/new_tests/test_index_deprecated.py @@ -13,7 +13,6 @@ class TestDeprecatedIndexCreationMethods: aerospike.Client.index_integer_create, aerospike.Client.index_string_create, aerospike.Client.index_geo2dsphere_create, - aerospike.Client.index_cdt_create, ] ) def test_deprecated_index_creation_methods(self, index_create_method): @@ -23,6 +22,13 @@ def test_deprecated_index_creation_methods(self, index_create_method): index_create_method(self.as_connection, 1, "demo", "bin_name", "deprecated_index") assert len(w) == 1 + def test_index_cdt_create_raises_warning(self): + with pytest.warns(DeprecationWarning): + try: + self.as_connection.index_cdt_create("test", "demo", "bin", aerospike.INDEX_TYPE_DEFAULT, aerospike.INDEX_NUMERIC, []) + except: + pass + def test_neg_cdtindex_with_no_paramters(self): """ Invoke index_cdt_create() without any mandatory parameters. From 52cc064fa2c27ce7066a54e3a06a3d01a25d1d84 Mon Sep 17 00:00:00 2001 From: Julian Nguyen <109386615+juliannguyen4@users.noreply.github.com> Date: Tue, 3 Mar 2026 15:06:34 -0800 Subject: [PATCH 3/8] Fix bug where the deprecated index creation methods use the wrong API name in the error message when receiving invalid args --- src/main/client/sec_index.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/client/sec_index.c b/src/main/client/sec_index.c index a0296474d0..9e6b38be3a 100644 --- a/src/main/client/sec_index.c +++ b/src/main/client/sec_index.c @@ -427,8 +427,8 @@ static PyObject *AerospikeClient_Index_Create_Deprecated_Helper( static char *kwlist[] = {"ns", "set", "bin", "name", "policy", NULL}; // Python Function Argument Parsing - if (PyArg_ParseTupleAndKeywords(args, kwds, "OOOO|O:index_integer_create", - kwlist, &py_ns, &py_set, &py_bin, &py_name, + if (PyArg_ParseTupleAndKeywords(args, kwds, "OOOO|O", kwlist, &py_ns, + &py_set, &py_bin, &py_name, &py_policy) == false) { return NULL; } @@ -498,10 +498,10 @@ PyObject *AerospikeClient_Index_Cdt_Create(AerospikeClient *self, "name", "ctx", "policy", NULL}; // Python Function Argument Parsing - if (PyArg_ParseTupleAndKeywords(args, kwds, "OOOOOOO|O:index_list_create", - kwlist, &py_ns, &py_set, &py_bin, - &py_indextype, &py_datatype, &py_name, - &py_ctx, &py_policy) == false) { + if (PyArg_ParseTupleAndKeywords(args, kwds, "OOOOOOO|O", kwlist, &py_ns, + &py_set, &py_bin, &py_indextype, + &py_datatype, &py_name, &py_ctx, + &py_policy) == false) { return NULL; } From 932221807c26e89c351949a5674f6d9f457110fc Mon Sep 17 00:00:00 2001 From: Julian Nguyen <109386615+juliannguyen4@users.noreply.github.com> Date: Wed, 25 Feb 2026 13:45:54 -0800 Subject: [PATCH 4/8] Address warnings --- test/new_tests/test_log.py | 2 +- test/new_tests/test_operate_helpers.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test/new_tests/test_log.py b/test/new_tests/test_log.py index 0a222eef80..554cefcc79 100644 --- a/test/new_tests/test_log.py +++ b/test/new_tests/test_log.py @@ -13,7 +13,7 @@ def custom_log_callback(level, func, path, line, msg): callback_called = True class TestLog(object): - @pytest.mark.fixture(autouse=True) + @pytest.fixture(autouse=True) def setup(self): global callback_called callback_called = False diff --git a/test/new_tests/test_operate_helpers.py b/test/new_tests/test_operate_helpers.py index d61a2e2a28..336bdfef5f 100644 --- a/test/new_tests/test_operate_helpers.py +++ b/test/new_tests/test_operate_helpers.py @@ -5,6 +5,7 @@ import aerospike from aerospike import exception as e +import warnings # OPERATIONS # aerospike.OPERATOR_WRITE @@ -317,7 +318,10 @@ def test_pos_operate_touch_operation_with_bin_and_value_combination(self, key, l Invoke operate() with touch value with bin and value combination. """ - self.as_connection.operate(key, llist) + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter(action="always", category=DeprecationWarning) + self.as_connection.operate(key, llist) + assert len(w) == 2 (key, meta) = self.as_connection.exists(key) From 72cea2a700fa81a3ed8f1542cab4802a2e61f7bb Mon Sep 17 00:00:00 2001 From: Julian Nguyen <109386615+juliannguyen4@users.noreply.github.com> Date: Tue, 3 Mar 2026 16:45:34 -0800 Subject: [PATCH 5/8] Address warnings for negative test cases for index_cdt_create --- test/new_tests/test_index_deprecated.py | 28 +++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/test/new_tests/test_index_deprecated.py b/test/new_tests/test_index_deprecated.py index 8a3234cb22..bc464e5ff0 100644 --- a/test/new_tests/test_index_deprecated.py +++ b/test/new_tests/test_index_deprecated.py @@ -33,8 +33,9 @@ def test_neg_cdtindex_with_no_paramters(self): """ Invoke index_cdt_create() without any mandatory parameters. """ - with pytest.raises(TypeError) as typeError: - self.as_connection.index_cdt_create() + with pytest.warns(DeprecationWarning): + with pytest.raises(TypeError) as typeError: + self.as_connection.index_cdt_create() assert "argument 'ns' (pos 1)" in str(typeError.value) @@ -47,14 +48,15 @@ def test_neg_cdtindex_with_no_paramters(self): ] ) def test_neg_cdtindex_with_invalid_ctx(self, ctx): - with pytest.raises(e.ParamError): - self.as_connection.index_cdt_create( - "test", - "demo", - "string_list", - aerospike.INDEX_TYPE_LIST, - aerospike.INDEX_STRING, - "test_string_list_cdt_index", - # Ctx must be a list - ctx - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(e.ParamError): + self.as_connection.index_cdt_create( + "test", + "demo", + "string_list", + aerospike.INDEX_TYPE_LIST, + aerospike.INDEX_STRING, + "test_string_list_cdt_index", + # Ctx must be a list + ctx + ) From 3f6c8c0f373f5668af404fefe8472ec02721d215 Mon Sep 17 00:00:00 2001 From: Julian Nguyen <109386615+juliannguyen4@users.noreply.github.com> Date: Wed, 25 Feb 2026 13:57:43 -0800 Subject: [PATCH 6/8] Fix test not handling DeprecationWarning from operations.touch --- test/new_tests/test_operate_helpers.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/test/new_tests/test_operate_helpers.py b/test/new_tests/test_operate_helpers.py index 336bdfef5f..0151eadb43 100644 --- a/test/new_tests/test_operate_helpers.py +++ b/test/new_tests/test_operate_helpers.py @@ -311,17 +311,22 @@ def test_pos_operate_with_policy_gen_EQ(self): assert bins == {"name": "name1aa"} @pytest.mark.parametrize( - "key, llist", [(("test", "demo", 1), [operations.touch(4000)]), (("test", "demo", 1), [operations.touch(4000)])] + "key", [ + ("test", "demo", 1) + ] ) - def test_pos_operate_touch_operation_with_bin_and_value_combination(self, key, llist): + def test_pos_operate_touch_operation_with_bin_and_value_combination(self, key): """ Invoke operate() with touch value with bin and value combination. """ with warnings.catch_warnings(record=True) as w: warnings.simplefilter(action="always", category=DeprecationWarning) - self.as_connection.operate(key, llist) - assert len(w) == 2 + ops = [ + operations.touch(4000) + ] + assert len(w) == 1 + self.as_connection.operate(key, ops) (key, meta) = self.as_connection.exists(key) From b7efd3c4229d2e9e73e4e23ac22084d604077330 Mon Sep 17 00:00:00 2001 From: Julian Nguyen <109386615+juliannguyen4@users.noreply.github.com> Date: Wed, 4 Mar 2026 09:13:17 -0800 Subject: [PATCH 7/8] Clean up negative api test cases --- test/new_tests/test_index_deprecated.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/test/new_tests/test_index_deprecated.py b/test/new_tests/test_index_deprecated.py index bc464e5ff0..67df56e2ca 100644 --- a/test/new_tests/test_index_deprecated.py +++ b/test/new_tests/test_index_deprecated.py @@ -24,10 +24,8 @@ def test_deprecated_index_creation_methods(self, index_create_method): def test_index_cdt_create_raises_warning(self): with pytest.warns(DeprecationWarning): - try: - self.as_connection.index_cdt_create("test", "demo", "bin", aerospike.INDEX_TYPE_DEFAULT, aerospike.INDEX_NUMERIC, []) - except: - pass + with pytest.raises(e.ParamError): + self.as_connection.index_cdt_create("test", "demo", "bin", aerospike.INDEX_TYPE_DEFAULT, aerospike.INDEX_NUMERIC, 2) def test_neg_cdtindex_with_no_paramters(self): """ @@ -36,8 +34,7 @@ def test_neg_cdtindex_with_no_paramters(self): with pytest.warns(DeprecationWarning): with pytest.raises(TypeError) as typeError: self.as_connection.index_cdt_create() - - assert "argument 'ns' (pos 1)" in str(typeError.value) + assert "argument 'ns' (pos 1)" in str(typeError.value) @pytest.mark.parametrize( "ctx", From 095a21daf5631f75541cf967ffdb22eb04d1bec1 Mon Sep 17 00:00:00 2001 From: Julian Nguyen <109386615+juliannguyen4@users.noreply.github.com> Date: Wed, 4 Mar 2026 09:50:02 -0800 Subject: [PATCH 8/8] just merge with another test case --- test/new_tests/test_index_deprecated.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/test/new_tests/test_index_deprecated.py b/test/new_tests/test_index_deprecated.py index 67df56e2ca..73e8a51abd 100644 --- a/test/new_tests/test_index_deprecated.py +++ b/test/new_tests/test_index_deprecated.py @@ -22,14 +22,10 @@ def test_deprecated_index_creation_methods(self, index_create_method): index_create_method(self.as_connection, 1, "demo", "bin_name", "deprecated_index") assert len(w) == 1 - def test_index_cdt_create_raises_warning(self): - with pytest.warns(DeprecationWarning): - with pytest.raises(e.ParamError): - self.as_connection.index_cdt_create("test", "demo", "bin", aerospike.INDEX_TYPE_DEFAULT, aerospike.INDEX_NUMERIC, 2) - def test_neg_cdtindex_with_no_paramters(self): """ Invoke index_cdt_create() without any mandatory parameters. + Also test that this API call raises a warning. """ with pytest.warns(DeprecationWarning): with pytest.raises(TypeError) as typeError: