Skip to content

Commit e59a1a9

Browse files
committed
test: update test adding compound queries with id filter issue #160
1 parent f98af09 commit e59a1a9

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

src/tests/older_versions/v152/test_issue_160.py renamed to src/tests/v1.6/test_issue_160.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22
from fireo.fields.errors import AttributeTypeError
3-
from fireo.fields import TextField, IDField
3+
from fireo.fields import TextField, IDField, BooleanField
44
from fireo.models import Model
55

66
# first try with default field name
@@ -91,4 +91,27 @@ class TestIssue160Model(Model):
9191
num_results = sum(1 for _ in results)
9292
assert num_results == 1
9393
except Exception:
94-
assert True == False
94+
assert True == False
95+
96+
def test_issue_160_with_compound_queries():
97+
class TestIssue160Model(Model):
98+
name = TextField()
99+
is_deleted = BooleanField()
100+
101+
test1 = TestIssue160Model(name='test1', is_deleted=False)
102+
test1.save()
103+
104+
test2 = TestIssue160Model(name='test2', is_deleted=True)
105+
test2.save()
106+
107+
test3 = TestIssue160Model(name='test3', is_deleted=True)
108+
test3.save()
109+
110+
try:
111+
docs = TestIssue160Model.collection.filter("id", "in", [test1.id, test2.id]).filter("is_deleted", "==", False).fetch()
112+
doc = next(docs)
113+
114+
assert doc.id == test1.id
115+
assert doc.name == test1.name
116+
except Exception:
117+
assert False == True

0 commit comments

Comments
 (0)