Skip to content

Commit 42bf75c

Browse files
committed
Fix predicates
1 parent 9706379 commit 42bf75c

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

test/asynchronous/test_examples.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,8 +1409,14 @@ async def test_snapshot_query(self):
14091409
{"name": "Pebbles", "color": "Brown", "age": 10, "adoptable": True}
14101410
)
14111411

1412-
await async_wait_until(functools.partial(self.check_for_snapshot, db.cats), "success")
1413-
await async_wait_until(functools.partial(self.check_for_snapshot, db.dogs), "success")
1412+
async def predicate_one():
1413+
return await self.check_for_snapshot(db.cats)
1414+
1415+
async def predicate_two():
1416+
return await self.check_for_snapshot(db.dogs)
1417+
1418+
await async_wait_until(predicate_two, "success")
1419+
await async_wait_until(predicate_one, "success")
14141420

14151421
# Start Snapshot Query Example 1
14161422

@@ -1443,7 +1449,11 @@ async def test_snapshot_query(self):
14431449

14441450
saleDate = datetime.datetime.now()
14451451
await db.sales.insert_one({"shoeType": "boot", "price": 30, "saleDate": saleDate})
1446-
await async_wait_until(functools.partial(self.check_for_snapshot, db.sales), "success")
1452+
1453+
async def predicate_three():
1454+
return await self.check_for_snapshot(db.sales)
1455+
1456+
await async_wait_until(predicate_three, "success")
14471457

14481458
# Start Snapshot Query Example 2
14491459
db = client.retail

test/test_examples.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,8 +1403,14 @@ def test_snapshot_query(self):
14031403
db.cats.insert_one({"name": "Whiskers", "color": "white", "age": 10, "adoptable": True})
14041404
db.dogs.insert_one({"name": "Pebbles", "color": "Brown", "age": 10, "adoptable": True})
14051405

1406-
wait_until(functools.partial(self.check_for_snapshot, db.cats), "success")
1407-
wait_until(functools.partial(self.check_for_snapshot, db.dogs), "success")
1406+
def predicate_one():
1407+
return self.check_for_snapshot(db.cats)
1408+
1409+
def predicate_two():
1410+
return self.check_for_snapshot(db.dogs)
1411+
1412+
wait_until(predicate_two, "success")
1413+
wait_until(predicate_one, "success")
14081414

14091415
# Start Snapshot Query Example 1
14101416

@@ -1437,7 +1443,11 @@ def test_snapshot_query(self):
14371443

14381444
saleDate = datetime.datetime.now()
14391445
db.sales.insert_one({"shoeType": "boot", "price": 30, "saleDate": saleDate})
1440-
wait_until(functools.partial(self.check_for_snapshot, db.sales), "success")
1446+
1447+
def predicate_three():
1448+
return self.check_for_snapshot(db.sales)
1449+
1450+
wait_until(predicate_three, "success")
14411451

14421452
# Start Snapshot Query Example 2
14431453
db = client.retail

0 commit comments

Comments
 (0)