Skip to content

Commit 06d588a

Browse files
committed
add unit tests
Signed-off-by: wiseaidev <[email protected]>
1 parent 57a3596 commit 06d588a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/test_hash_model.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class Order(BaseHashModel):
4343
created_on: datetime.datetime
4444

4545
class Member(BaseHashModel):
46+
id: int = Field(index=True)
4647
first_name: str = Field(index=True)
4748
last_name: str = Field(index=True)
4849
email: str = Field(index=True)
@@ -64,6 +65,7 @@ class Meta:
6465
@pytest_asyncio.fixture
6566
async def members(m):
6667
member1 = m.Member(
68+
id=0,
6769
first_name="Andrew",
6870
last_name="Brookins",
6971
@@ -73,6 +75,7 @@ async def members(m):
7375
)
7476

7577
member2 = m.Member(
78+
id=1,
7679
first_name="Kim",
7780
last_name="Brookins",
7881
@@ -82,6 +85,7 @@ async def members(m):
8285
)
8386

8487
member3 = m.Member(
88+
id=2,
8589
first_name="Andrew",
8690
last_name="Smith",
8791
@@ -129,6 +133,9 @@ async def test_exact_match_queries(members, m):
129133
).all()
130134
assert actual == [member2]
131135

136+
actual = await m.Member.find(m.Member.id == 0).all()
137+
assert actual == [member1]
138+
132139

133140
@py_test_mark_asyncio
134141
async def test_full_text_search_queries(members, m):
@@ -611,4 +618,4 @@ class Address(m.BaseHashModel):
611618
assert (
612619
Address.redisearch_schema()
613620
== f"ON HASH PREFIX 1 {key_prefix} SCHEMA pk TAG SEPARATOR | a_string TAG SEPARATOR | a_full_text_string TAG SEPARATOR | a_full_text_string AS a_full_text_string_fts TEXT an_integer NUMERIC SORTABLE a_float NUMERIC"
614-
)
621+
)

0 commit comments

Comments
 (0)