reformat with latest black

This commit is contained in:
Bastien Gérard 2020-01-07 21:44:04 +01:00
parent 84f3dce492
commit e64a7a9448
3 changed files with 5 additions and 3 deletions

View File

@ -11,7 +11,9 @@ PYMONGO_VERSION = tuple(pymongo.version_tuple[:2])
IS_PYMONGO_GTE_37 = PYMONGO_VERSION >= _PYMONGO_37 IS_PYMONGO_GTE_37 = PYMONGO_VERSION >= _PYMONGO_37
def count_documents(collection, filter, skip=None, limit=None, hint=None, collation=None): def count_documents(
collection, filter, skip=None, limit=None, hint=None, collation=None
):
"""Pymongo>3.7 deprecates count in favour of count_documents """Pymongo>3.7 deprecates count in favour of count_documents
""" """
if limit == 0: if limit == 0:

View File

@ -404,7 +404,7 @@ class BaseQuerySet(object):
if self._limit == 0: if self._limit == 0:
# mimic the fact that historically .limit(0) sets no limit # mimic the fact that historically .limit(0) sets no limit
kwargs.pop('limit', None) kwargs.pop("limit", None)
if self._hint not in (-1, None): if self._hint not in (-1, None):
kwargs["hint"] = self._hint kwargs["hint"] = self._hint

View File

@ -554,7 +554,7 @@ class TestIndexes(unittest.TestCase):
incorrect_collation = {"arndom": "wrdo"} incorrect_collation = {"arndom": "wrdo"}
with pytest.raises(OperationFailure) as exc_info: with pytest.raises(OperationFailure) as exc_info:
BlogPost.objects.collation(incorrect_collation).count() BlogPost.objects.collation(incorrect_collation).count()
assert 'Missing expected field' in str(exc_info.value) assert "Missing expected field" in str(exc_info.value)
query_result = BlogPost.objects.collation({}).order_by("name") query_result = BlogPost.objects.collation({}).order_by("name")
assert [x.name for x in query_result] == sorted(names) assert [x.name for x in query_result] == sorted(names)