Skip to content

Commit 26d54fe

Browse files
use refresh instead of wait loop
1 parent c88ef94 commit 26d54fe

File tree

2 files changed

+8
-22
lines changed

2 files changed

+8
-22
lines changed

tests/test_integration/_async/test_document.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -516,19 +516,12 @@ async def test_update_empty_field(async_client):
516516
await Tags._index.delete(ignore_unavailable=True)
517517
await Tags.init()
518518
d = Tags(id="123", tags=["a", "b"])
519-
await d.save(wait_for_active_shards=1)
520-
await d.update(tags=[])
519+
await d.save(refresh=True)
520+
await d.update(tags=[], refresh=True)
521521
assert d.tags == []
522522

523-
while True:
524-
try:
525-
r = await Tags.search().execute()
526-
d = r.hits[0]
527-
except IndexError:
528-
continue
529-
else:
530-
break
531-
assert d.tags == []
523+
r = await Tags.search().execute()
524+
assert r.hits[0].tags == []
532525

533526

534527
@pytest.mark.asyncio

tests/test_integration/_sync/test_document.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -510,19 +510,12 @@ def test_update_empty_field(client):
510510
Tags._index.delete(ignore_unavailable=True)
511511
Tags.init()
512512
d = Tags(id="123", tags=["a", "b"])
513-
d.save(wait_for_active_shards=1)
514-
d.update(tags=[])
513+
d.save(refresh=True)
514+
d.update(tags=[], refresh=True)
515515
assert d.tags == []
516516

517-
while True:
518-
try:
519-
r = Tags.search().execute()
520-
d = r.hits[0]
521-
except IndexError:
522-
continue
523-
else:
524-
break
525-
assert d.tags == []
517+
r = Tags.search().execute()
518+
assert r.hits[0].tags == []
526519

527520

528521
@pytest.mark.sync

0 commit comments

Comments
 (0)