Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cbabb00550 | ||
|
|
7ab5080b62 | ||
|
|
62cf1742fc |
@ -3,6 +3,10 @@ Changelog
|
||||
|
||||
.. currentmodule:: motor.motor_tornado
|
||||
|
||||
Motor 3.3.1
|
||||
-----------
|
||||
- Fix a bug in the type hint for :meth:`MotorCursor.to_list`.
|
||||
|
||||
Motor 3.3.0
|
||||
-----------
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
"""Version-related data for motor."""
|
||||
|
||||
version_tuple = (3, 3, 0)
|
||||
version_tuple = (3, 3, 2, ".dev0")
|
||||
|
||||
|
||||
def get_version_string() -> str:
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from asyncio import Future
|
||||
from typing import (
|
||||
Any,
|
||||
Awaitable,
|
||||
@ -654,11 +655,11 @@ class AgnosticBaseCursor(AgnosticBase):
|
||||
async def __aexit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> Any: ...
|
||||
def _get_more(self) -> int: ...
|
||||
@property
|
||||
def fetch_next(self) -> Any: ...
|
||||
def fetch_next(self) -> Future[Any]: ...
|
||||
def next_object(self) -> Any: ...
|
||||
def each(self, callback: Callable) -> None: ...
|
||||
def _each_got_more(self, callback: Callable, future: Any) -> None: ...
|
||||
def to_list(self, length: int) -> List: ...
|
||||
def to_list(self, length: int) -> Future[List]: ...
|
||||
def _to_list(self, length: int, the_list: List, future: Any, get_more_result: Any) -> None: ...
|
||||
def get_io_loop(self) -> Any: ...
|
||||
def batch_size(self, batch_size: int) -> AgnosticBaseCursor: ...
|
||||
|
||||
@ -17,7 +17,7 @@ sample client code that uses Motor typings.
|
||||
"""
|
||||
import unittest
|
||||
from test.asyncio_tests import AsyncIOTestCase, asyncio_test
|
||||
from typing import TYPE_CHECKING, Any, AsyncIterable, Dict, List, Union
|
||||
from typing import TYPE_CHECKING, Any, Dict, List, Union
|
||||
|
||||
from bson import CodecOptions
|
||||
from bson.raw_bson import RawBSONDocument
|
||||
@ -80,13 +80,10 @@ class TestMotor(AsyncIOTestCase):
|
||||
self.assertEqual(result2.inserted_id, result.inserted_id)
|
||||
|
||||
@asyncio_test
|
||||
async def test_cursor_iterable(self) -> None:
|
||||
async def to_list(iterable: AsyncIterable[Dict[str, Any]]) -> List[Dict[str, Any]]:
|
||||
return [gen async for gen in iterable]
|
||||
|
||||
async def test_cursor_to_list(self) -> None:
|
||||
await self.collection.insert_one({})
|
||||
cursor = self.collection.find()
|
||||
docs = await to_list(cursor)
|
||||
docs = await cursor.to_list(None)
|
||||
self.assertTrue(docs)
|
||||
|
||||
@only_type_check
|
||||
|
||||
Loading…
Reference in New Issue
Block a user