Skip to content

Commit

Permalink
[CLIENT-3057] Add missing aerospike_helpers.expressions.resources.Res…
Browse files Browse the repository at this point in the history
…ultType constant NIL (#658)
  • Loading branch information
juliannguyen4 authored Aug 27, 2024
1 parent 27d9a52 commit 329e94e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion aerospike_helpers/expressions/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class ResultType:
"""
Flags used to indicate expression value_type.
"""

NIL = 0
BOOLEAN = 1
INTEGER = 2
STRING = 3
Expand Down
14 changes: 11 additions & 3 deletions test/new_tests/test_expressions_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class TestExpressions(TestBaseClass):
def setup(self, request, as_connection):
self.test_ns = "test"
self.test_set = "demo"

self.first_key = (self.test_ns, self.test_set, 0)
for i in range(_NUM_RECORDS):
key = ("test", "demo", i)
rec = {
Expand Down Expand Up @@ -828,7 +828,15 @@ def test_map_expr_inverted(self, bin_name: str, expr, expected):
ops = [
expr_ops.expression_read(bin_name, expr.compile())
]
key = (self.test_ns, self.test_set, 0)
_, _, bins = self.as_connection.operate(key, ops)
_, _, bins = self.as_connection.operate(self.first_key, ops)

assert bins[bin_name] == expected

def test_map_get_nil_value_type(self):
bin_name = "nmap_bin"
exp = MapGetByKey(None, aerospike.MAP_RETURN_VALUE, ResultType.NIL, 2, bin_name).compile()
ops = [
expr_ops.expression_read(bin_name, exp)
]
_, _, bins = self.as_connection.operate(self.first_key, ops)
assert bins[bin_name] is None

0 comments on commit 329e94e

Please sign in to comment.