Skip to content

Commit f0e025a

Browse files
authored
PYTHON-4533 - Convert test/test_cursor.py to async (mongodb#1731)
1 parent b6f72ad commit f0e025a

File tree

8 files changed

+2017
-195
lines changed

8 files changed

+2017
-195
lines changed

pymongo/asynchronous/command_cursor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,4 +424,4 @@ def _unpack_response( # type: ignore[override]
424424
return raw_response # type: ignore[return-value]
425425

426426
def __getitem__(self, index: int) -> NoReturn:
427-
raise InvalidOperation("Cannot call __getitem__ on RawBatchCursor")
427+
raise InvalidOperation("Cannot call __getitem__ on AsyncRawBatchCommandCursor")

pymongo/asynchronous/cursor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ def __init__(
242242
self._exhaust_checked = True
243243
self._supports_exhaust() # type: ignore[unused-coroutine]
244244
else:
245+
self._exhaust = cursor_type == CursorType.EXHAUST
245246
self._exhaust_checked = False
246247

247248
async def _supports_exhaust(self) -> None:
@@ -1318,4 +1319,4 @@ async def explain(self) -> _DocumentType:
13181319
return await clone.explain()
13191320

13201321
def __getitem__(self, index: Any) -> NoReturn:
1321-
raise InvalidOperation("Cannot call __getitem__ on RawBatchCursor")
1322+
raise InvalidOperation("Cannot call __getitem__ on AsyncRawBatchCursor")

pymongo/synchronous/command_cursor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,4 +424,4 @@ def _unpack_response( # type: ignore[override]
424424
return raw_response # type: ignore[return-value]
425425

426426
def __getitem__(self, index: int) -> NoReturn:
427-
raise InvalidOperation("Cannot call __getitem__ on RawBatchCursor")
427+
raise InvalidOperation("Cannot call __getitem__ on RawBatchCommandCursor")

pymongo/synchronous/cursor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ def __init__(
242242
self._exhaust_checked = True
243243
self._supports_exhaust() # type: ignore[unused-coroutine]
244244
else:
245+
self._exhaust = cursor_type == CursorType.EXHAUST
245246
self._exhaust_checked = False
246247

247248
def _supports_exhaust(self) -> None:

0 commit comments

Comments
 (0)