fix black formatting

This commit is contained in:
Bastien Gérard 2019-10-31 22:39:53 +01:00
parent 6040b4b494
commit 37ca79e9c5
15 changed files with 31 additions and 34 deletions

View File

@ -11,7 +11,8 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys, os
import os
import sys
import sphinx_rtd_theme

View File

@ -247,8 +247,8 @@ class query_counter(object):
- self._ctx_query_counter
)
self._ctx_query_counter += (
1
) # Account for the query we just issued to gather the information
1 # Account for the query we just issued to gather the information
)
return count

View File

@ -1193,9 +1193,7 @@ class BaseQuerySet(object):
validate_read_preference("read_preference", read_preference)
queryset = self.clone()
queryset._read_preference = read_preference
queryset._cursor_obj = (
None
) # we need to re-create the cursor object whenever we apply read_preference
queryset._cursor_obj = None # we need to re-create the cursor object whenever we apply read_preference
return queryset
def scalar(self, *fields):

View File

@ -1615,7 +1615,7 @@ class TestInstance(MongoDBTestCase):
self.assertEqual(person.active, False)
def test__get_changed_fields_same_ids_reference_field_does_not_enters_infinite_loop_embedded_doc(
self
self,
):
# Refers to Issue #1685
class EmbeddedChildModel(EmbeddedDocument):
@ -1629,7 +1629,7 @@ class TestInstance(MongoDBTestCase):
self.assertEqual(changed_fields, [])
def test__get_changed_fields_same_ids_reference_field_does_not_enters_infinite_loop_different_doc(
self
self,
):
# Refers to Issue #1685
class User(Document):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import datetime
import math
import itertools
import math
import re
from mongoengine import *

View File

@ -1,17 +1,15 @@
# -*- coding: utf-8 -*-
from mongoengine import (
Document,
StringField,
ValidationError,
EmbeddedDocument,
EmbeddedDocumentField,
InvalidQueryError,
LookUpError,
IntField,
GenericEmbeddedDocumentField,
IntField,
InvalidQueryError,
ListField,
EmbeddedDocumentListField,
ReferenceField,
LookUpError,
StringField,
ValidationError,
)
from tests.utils import MongoDBTestCase

View File

@ -79,7 +79,7 @@ class TestField(MongoDBTestCase):
self.assertEqual(data_to_be_saved, ["age", "created", "day", "name", "userid"])
def test_custom_field_validation_raise_deprecated_error_when_validation_return_something(
self
self,
):
# Covers introduction of a breaking change in the validation parameter (0.18)
def _not_empty(z):
@ -202,7 +202,7 @@ class TestField(MongoDBTestCase):
self.assertEqual(data_to_be_saved, ["age", "created", "userid"])
def test_default_value_is_not_used_when_changing_value_to_empty_list_for_strict_doc(
self
self,
):
"""List field with default can be set to the empty list (strict)"""
# Issue #1733
@ -216,7 +216,7 @@ class TestField(MongoDBTestCase):
self.assertEqual(reloaded.x, [])
def test_default_value_is_not_used_when_changing_value_to_empty_list_for_dyn_doc(
self
self,
):
"""List field with default can be set to the empty list (dynamic)"""
# Issue #1733
@ -1245,7 +1245,7 @@ class TestField(MongoDBTestCase):
self.assertEqual(a.b.c.txt, "hi")
def test_embedded_document_field_cant_reference_using_a_str_if_it_does_not_exist_yet(
self
self,
):
raise SkipTest(
"Using a string reference in an EmbeddedDocumentField does not work if the class isnt registerd yet"

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from bson import SON, DBRef
from bson import DBRef, SON
from mongoengine import *

View File

@ -1,7 +1,7 @@
import unittest
from mongoengine.common import _import_class
from mongoengine import Document
from mongoengine.common import _import_class
class TestCommon(unittest.TestCase):

View File

@ -168,7 +168,7 @@ class ConnectionTest(unittest.TestCase):
)
def test_connect_fails_if_similar_connection_settings_arent_defined_the_same_way(
self
self,
):
"""Intended to keep the detecton function simple but robust"""
db_name = "mongoenginetest"

View File

@ -3,11 +3,11 @@ import unittest
from mongoengine import *
from mongoengine.connection import get_db
from mongoengine.context_managers import (
switch_db,
switch_collection,
no_sub_classes,
no_dereference,
no_sub_classes,
query_counter,
switch_collection,
switch_db,
)
from mongoengine.pymongo_support import count_documents

View File

@ -2,7 +2,7 @@ import unittest
from six import iterkeys
from mongoengine import Document
from mongoengine.base.datastructures import StrictDict, BaseList, BaseDict
from mongoengine.base.datastructures import BaseDict, BaseList, StrictDict
class DocumentStub(object):
@ -20,8 +20,8 @@ class TestBaseDict(unittest.TestCase):
fake_doc = DocumentStub()
base_list = BaseDict(dict_items, instance=None, name="my_name")
base_list._instance = (
fake_doc
) # hack to inject the mock, it does not work in the constructor
fake_doc # hack to inject the mock, it does not work in the constructor
)
return base_list
def test___init___(self):
@ -156,8 +156,8 @@ class TestBaseList(unittest.TestCase):
fake_doc = DocumentStub()
base_list = BaseList(list_items, instance=None, name="my_name")
base_list._instance = (
fake_doc
) # hack to inject the mock, it does not work in the constructor
fake_doc # hack to inject the mock, it does not work in the constructor
)
return base_list
def test___init___(self):

View File

@ -1,7 +1,7 @@
import unittest
from pymongo import ReadPreference
from pymongo import MongoClient
from pymongo import ReadPreference
import mongoengine
from mongoengine.connection import ConnectionFailure

View File

@ -1,5 +1,5 @@
import unittest
import re
import unittest
from mongoengine.base.utils import LazyRegexCompiler

View File

@ -4,7 +4,7 @@ import unittest
from nose.plugins.skip import SkipTest
from mongoengine import connect
from mongoengine.connection import get_db, disconnect_all
from mongoengine.connection import disconnect_all, get_db
from mongoengine.mongodb_support import get_mongodb_version