fix black formatting
This commit is contained in:
parent
6040b4b494
commit
37ca79e9c5
@ -11,7 +11,8 @@
|
|||||||
# All configuration values have a default; values that are commented out
|
# All configuration values have a default; values that are commented out
|
||||||
# serve to show the default.
|
# serve to show the default.
|
||||||
|
|
||||||
import sys, os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
import sphinx_rtd_theme
|
import sphinx_rtd_theme
|
||||||
|
|
||||||
|
@ -247,8 +247,8 @@ class query_counter(object):
|
|||||||
- self._ctx_query_counter
|
- self._ctx_query_counter
|
||||||
)
|
)
|
||||||
self._ctx_query_counter += (
|
self._ctx_query_counter += (
|
||||||
1
|
1 # Account for the query we just issued to gather the information
|
||||||
) # Account for the query we just issued to gather the information
|
)
|
||||||
return count
|
return count
|
||||||
|
|
||||||
|
|
||||||
|
@ -1193,9 +1193,7 @@ class BaseQuerySet(object):
|
|||||||
validate_read_preference("read_preference", read_preference)
|
validate_read_preference("read_preference", read_preference)
|
||||||
queryset = self.clone()
|
queryset = self.clone()
|
||||||
queryset._read_preference = read_preference
|
queryset._read_preference = read_preference
|
||||||
queryset._cursor_obj = (
|
queryset._cursor_obj = None # we need to re-create the cursor object whenever we apply read_preference
|
||||||
None
|
|
||||||
) # we need to re-create the cursor object whenever we apply read_preference
|
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
def scalar(self, *fields):
|
def scalar(self, *fields):
|
||||||
|
@ -1615,7 +1615,7 @@ class TestInstance(MongoDBTestCase):
|
|||||||
self.assertEqual(person.active, False)
|
self.assertEqual(person.active, False)
|
||||||
|
|
||||||
def test__get_changed_fields_same_ids_reference_field_does_not_enters_infinite_loop_embedded_doc(
|
def test__get_changed_fields_same_ids_reference_field_does_not_enters_infinite_loop_embedded_doc(
|
||||||
self
|
self,
|
||||||
):
|
):
|
||||||
# Refers to Issue #1685
|
# Refers to Issue #1685
|
||||||
class EmbeddedChildModel(EmbeddedDocument):
|
class EmbeddedChildModel(EmbeddedDocument):
|
||||||
@ -1629,7 +1629,7 @@ class TestInstance(MongoDBTestCase):
|
|||||||
self.assertEqual(changed_fields, [])
|
self.assertEqual(changed_fields, [])
|
||||||
|
|
||||||
def test__get_changed_fields_same_ids_reference_field_does_not_enters_infinite_loop_different_doc(
|
def test__get_changed_fields_same_ids_reference_field_does_not_enters_infinite_loop_different_doc(
|
||||||
self
|
self,
|
||||||
):
|
):
|
||||||
# Refers to Issue #1685
|
# Refers to Issue #1685
|
||||||
class User(Document):
|
class User(Document):
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import datetime
|
import datetime
|
||||||
import math
|
|
||||||
import itertools
|
import itertools
|
||||||
|
import math
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from mongoengine import *
|
from mongoengine import *
|
||||||
|
@ -1,17 +1,15 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from mongoengine import (
|
from mongoengine import (
|
||||||
Document,
|
Document,
|
||||||
StringField,
|
|
||||||
ValidationError,
|
|
||||||
EmbeddedDocument,
|
EmbeddedDocument,
|
||||||
EmbeddedDocumentField,
|
EmbeddedDocumentField,
|
||||||
InvalidQueryError,
|
|
||||||
LookUpError,
|
|
||||||
IntField,
|
|
||||||
GenericEmbeddedDocumentField,
|
GenericEmbeddedDocumentField,
|
||||||
|
IntField,
|
||||||
|
InvalidQueryError,
|
||||||
ListField,
|
ListField,
|
||||||
EmbeddedDocumentListField,
|
LookUpError,
|
||||||
ReferenceField,
|
StringField,
|
||||||
|
ValidationError,
|
||||||
)
|
)
|
||||||
|
|
||||||
from tests.utils import MongoDBTestCase
|
from tests.utils import MongoDBTestCase
|
||||||
|
@ -79,7 +79,7 @@ class TestField(MongoDBTestCase):
|
|||||||
self.assertEqual(data_to_be_saved, ["age", "created", "day", "name", "userid"])
|
self.assertEqual(data_to_be_saved, ["age", "created", "day", "name", "userid"])
|
||||||
|
|
||||||
def test_custom_field_validation_raise_deprecated_error_when_validation_return_something(
|
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)
|
# Covers introduction of a breaking change in the validation parameter (0.18)
|
||||||
def _not_empty(z):
|
def _not_empty(z):
|
||||||
@ -202,7 +202,7 @@ class TestField(MongoDBTestCase):
|
|||||||
self.assertEqual(data_to_be_saved, ["age", "created", "userid"])
|
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(
|
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)"""
|
"""List field with default can be set to the empty list (strict)"""
|
||||||
# Issue #1733
|
# Issue #1733
|
||||||
@ -216,7 +216,7 @@ class TestField(MongoDBTestCase):
|
|||||||
self.assertEqual(reloaded.x, [])
|
self.assertEqual(reloaded.x, [])
|
||||||
|
|
||||||
def test_default_value_is_not_used_when_changing_value_to_empty_list_for_dyn_doc(
|
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)"""
|
"""List field with default can be set to the empty list (dynamic)"""
|
||||||
# Issue #1733
|
# Issue #1733
|
||||||
@ -1245,7 +1245,7 @@ class TestField(MongoDBTestCase):
|
|||||||
self.assertEqual(a.b.c.txt, "hi")
|
self.assertEqual(a.b.c.txt, "hi")
|
||||||
|
|
||||||
def test_embedded_document_field_cant_reference_using_a_str_if_it_does_not_exist_yet(
|
def test_embedded_document_field_cant_reference_using_a_str_if_it_does_not_exist_yet(
|
||||||
self
|
self,
|
||||||
):
|
):
|
||||||
raise SkipTest(
|
raise SkipTest(
|
||||||
"Using a string reference in an EmbeddedDocumentField does not work if the class isnt registerd yet"
|
"Using a string reference in an EmbeddedDocumentField does not work if the class isnt registerd yet"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from bson import SON, DBRef
|
from bson import DBRef, SON
|
||||||
|
|
||||||
from mongoengine import *
|
from mongoengine import *
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from mongoengine.common import _import_class
|
|
||||||
from mongoengine import Document
|
from mongoengine import Document
|
||||||
|
from mongoengine.common import _import_class
|
||||||
|
|
||||||
|
|
||||||
class TestCommon(unittest.TestCase):
|
class TestCommon(unittest.TestCase):
|
||||||
|
@ -168,7 +168,7 @@ class ConnectionTest(unittest.TestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def test_connect_fails_if_similar_connection_settings_arent_defined_the_same_way(
|
def test_connect_fails_if_similar_connection_settings_arent_defined_the_same_way(
|
||||||
self
|
self,
|
||||||
):
|
):
|
||||||
"""Intended to keep the detecton function simple but robust"""
|
"""Intended to keep the detecton function simple but robust"""
|
||||||
db_name = "mongoenginetest"
|
db_name = "mongoenginetest"
|
||||||
|
@ -3,11 +3,11 @@ import unittest
|
|||||||
from mongoengine import *
|
from mongoengine import *
|
||||||
from mongoengine.connection import get_db
|
from mongoengine.connection import get_db
|
||||||
from mongoengine.context_managers import (
|
from mongoengine.context_managers import (
|
||||||
switch_db,
|
|
||||||
switch_collection,
|
|
||||||
no_sub_classes,
|
|
||||||
no_dereference,
|
no_dereference,
|
||||||
|
no_sub_classes,
|
||||||
query_counter,
|
query_counter,
|
||||||
|
switch_collection,
|
||||||
|
switch_db,
|
||||||
)
|
)
|
||||||
from mongoengine.pymongo_support import count_documents
|
from mongoengine.pymongo_support import count_documents
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import unittest
|
|||||||
from six import iterkeys
|
from six import iterkeys
|
||||||
|
|
||||||
from mongoengine import Document
|
from mongoengine import Document
|
||||||
from mongoengine.base.datastructures import StrictDict, BaseList, BaseDict
|
from mongoengine.base.datastructures import BaseDict, BaseList, StrictDict
|
||||||
|
|
||||||
|
|
||||||
class DocumentStub(object):
|
class DocumentStub(object):
|
||||||
@ -20,8 +20,8 @@ class TestBaseDict(unittest.TestCase):
|
|||||||
fake_doc = DocumentStub()
|
fake_doc = DocumentStub()
|
||||||
base_list = BaseDict(dict_items, instance=None, name="my_name")
|
base_list = BaseDict(dict_items, instance=None, name="my_name")
|
||||||
base_list._instance = (
|
base_list._instance = (
|
||||||
fake_doc
|
fake_doc # hack to inject the mock, it does not work in the constructor
|
||||||
) # hack to inject the mock, it does not work in the constructor
|
)
|
||||||
return base_list
|
return base_list
|
||||||
|
|
||||||
def test___init___(self):
|
def test___init___(self):
|
||||||
@ -156,8 +156,8 @@ class TestBaseList(unittest.TestCase):
|
|||||||
fake_doc = DocumentStub()
|
fake_doc = DocumentStub()
|
||||||
base_list = BaseList(list_items, instance=None, name="my_name")
|
base_list = BaseList(list_items, instance=None, name="my_name")
|
||||||
base_list._instance = (
|
base_list._instance = (
|
||||||
fake_doc
|
fake_doc # hack to inject the mock, it does not work in the constructor
|
||||||
) # hack to inject the mock, it does not work in the constructor
|
)
|
||||||
return base_list
|
return base_list
|
||||||
|
|
||||||
def test___init___(self):
|
def test___init___(self):
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from pymongo import ReadPreference
|
|
||||||
from pymongo import MongoClient
|
from pymongo import MongoClient
|
||||||
|
from pymongo import ReadPreference
|
||||||
|
|
||||||
import mongoengine
|
import mongoengine
|
||||||
from mongoengine.connection import ConnectionFailure
|
from mongoengine.connection import ConnectionFailure
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import unittest
|
|
||||||
import re
|
import re
|
||||||
|
import unittest
|
||||||
|
|
||||||
from mongoengine.base.utils import LazyRegexCompiler
|
from mongoengine.base.utils import LazyRegexCompiler
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import unittest
|
|||||||
from nose.plugins.skip import SkipTest
|
from nose.plugins.skip import SkipTest
|
||||||
|
|
||||||
from mongoengine import connect
|
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
|
from mongoengine.mongodb_support import get_mongodb_version
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user