Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for server side NOT_IN filter. #957

Merged
merged 4 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Next Next commit
tests: Add a test for IN queries with a more complex python object.
  • Loading branch information
sorced-jim committed Feb 29, 2024
commit 3a580d23445f54ab031663db6d9019aab637c7cd
22 changes: 22 additions & 0 deletions tests/system/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -1866,6 +1866,28 @@ class SomeKind(ndb.Model):
assert results[1].foo == 3


@pytest.mark.filterwarnings("ignore")
@pytest.mark.usefixtures("client_context")
def test_IN_timestamp(ds_entity):
for i in range(5):
entity_id = test_utils.system.unique_resource_id()
ds_entity(KIND, entity_id, foo=datetime.datetime.fromtimestamp(i))

class SomeKind(ndb.Model):
foo = ndb.DateTimeProperty()

eventually(SomeKind.query().fetch, length_equals(5))

t2 = datetime.datetime.fromtimestamp(2)
t3 = datetime.datetime.fromtimestamp(3)

query = SomeKind.query(SomeKind.foo.IN((t2, t3), server_op=True))
results = query.fetch()
assert len(results) == 2
assert results[0].foo == t2
assert results[1].foo == t3


@pytest.mark.usefixtures("client_context")
def test_projection_with_json_property(dispose_of):
"""Regression test for #378
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ def test__IN_client():
assert or_node == prop.IN(["a", None, "xy"])

@staticmethod
def test_server__IN():
def test__IN_server():
prop = model.Property("name", indexed=True)
in_node = prop._IN(["a", None, "xy"], server_op=True)
assert in_node == prop.IN(["a", None, "xy"], server_op=True)
Expand Down