Skip to content

Commit 78f96f4

Browse files
DOC-4345 avoid possible non-deterministic results in tests
1 parent 86205f7 commit 78f96f4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

doctests/home_json.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
r.ft("idx:users").dropindex(True)
2525
except redis.exceptions.ResponseError:
2626
pass
27+
2728
r.delete("user:1", "user:2", "user:3")
2829
# REMOVE_END
2930

@@ -34,12 +35,14 @@
3435
"age": 42,
3536
"city": "London"
3637
}
38+
3739
user2 = {
3840
"name": "Eden Zamir",
3941
"email": "[email protected]",
4042
"age": 29,
4143
"city": "Tel Aviv"
4244
}
45+
4346
user3 = {
4447
"name": "Paul Zamir",
4548
"email": "[email protected]",
@@ -113,6 +116,8 @@
113116

114117
# Tests for 'query2' step.
115118
# REMOVE_START
119+
citiesResult.sort(key=lambda doc: doc['id'])
120+
116121
assert str(citiesResult) == (
117122
"[Document {'id': 'user:1', 'payload': None, 'city': 'London'}, "
118123
+ "Document {'id': 'user:3', 'payload': None, 'city': 'Tel Aviv'}]"
@@ -132,6 +137,8 @@
132137

133138
# Tests for 'query3' step.
134139
# REMOVE_START
140+
aggResult.sort(key=lambda row: row[1])
141+
135142
assert str(aggResult) == (
136143
"[['city', 'London', 'count', '1'], ['city', 'Tel Aviv', 'count', '2']]"
137144
)

0 commit comments

Comments
 (0)