remove inheritance from unittest.TestCase on basic test classes
This commit is contained in:
parent
799cdafae6
commit
d8924ed892
@ -6,7 +6,7 @@ from mongoengine import *
|
|||||||
from mongoengine.queryset import QueryFieldList
|
from mongoengine.queryset import QueryFieldList
|
||||||
|
|
||||||
|
|
||||||
class TestQueryFieldList(unittest.TestCase):
|
class TestQueryFieldList:
|
||||||
def test_empty(self):
|
def test_empty(self):
|
||||||
q = QueryFieldList()
|
q = QueryFieldList()
|
||||||
assert not q
|
assert not q
|
||||||
|
@ -6,7 +6,7 @@ from mongoengine import Document
|
|||||||
from mongoengine.common import _import_class
|
from mongoengine.common import _import_class
|
||||||
|
|
||||||
|
|
||||||
class TestCommon(unittest.TestCase):
|
class TestCommon:
|
||||||
def test__import_class(self):
|
def test__import_class(self):
|
||||||
doc_cls = _import_class("Document")
|
doc_cls = _import_class("Document")
|
||||||
assert doc_cls is Document
|
assert doc_cls is Document
|
||||||
|
@ -14,7 +14,7 @@ from mongoengine.context_managers import (
|
|||||||
from mongoengine.pymongo_support import count_documents
|
from mongoengine.pymongo_support import count_documents
|
||||||
|
|
||||||
|
|
||||||
class ContextManagersTest(unittest.TestCase):
|
class TestContextManagers:
|
||||||
def test_switch_db_context_manager(self):
|
def test_switch_db_context_manager(self):
|
||||||
connect("mongoenginetest")
|
connect("mongoenginetest")
|
||||||
register_connection("testdb-1", "mongoenginetest2")
|
register_connection("testdb-1", "mongoenginetest2")
|
||||||
|
@ -15,7 +15,7 @@ class DocumentStub(object):
|
|||||||
self._changed_fields.append(key)
|
self._changed_fields.append(key)
|
||||||
|
|
||||||
|
|
||||||
class TestBaseDict(unittest.TestCase):
|
class TestBaseDict:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_basedict(dict_items):
|
def _get_basedict(dict_items):
|
||||||
"""Get a BaseList bound to a fake document instance"""
|
"""Get a BaseList bound to a fake document instance"""
|
||||||
@ -151,7 +151,7 @@ class TestBaseDict(unittest.TestCase):
|
|||||||
assert base_dict._instance._changed_fields == ["my_name.a_new_attr"]
|
assert base_dict._instance._changed_fields == ["my_name.a_new_attr"]
|
||||||
|
|
||||||
|
|
||||||
class TestBaseList(unittest.TestCase):
|
class TestBaseList:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_baselist(list_items):
|
def _get_baselist(list_items):
|
||||||
"""Get a BaseList bound to a fake document instance"""
|
"""Get a BaseList bound to a fake document instance"""
|
||||||
@ -360,12 +360,12 @@ class TestBaseList(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
class TestStrictDict(unittest.TestCase):
|
class TestStrictDict(unittest.TestCase):
|
||||||
def strict_dict_class(self, *args, **kwargs):
|
|
||||||
return StrictDict.create(*args, **kwargs)
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.dtype = self.strict_dict_class(("a", "b", "c"))
|
self.dtype = self.strict_dict_class(("a", "b", "c"))
|
||||||
|
|
||||||
|
def strict_dict_class(self, *args, **kwargs):
|
||||||
|
return StrictDict.create(*args, **kwargs)
|
||||||
|
|
||||||
def test_init(self):
|
def test_init(self):
|
||||||
d = self.dtype(a=1, b=1, c=1)
|
d = self.dtype(a=1, b=1, c=1)
|
||||||
assert (d.a, d.b, d.c) == (1, 1, 1)
|
assert (d.a, d.b, d.c) == (1, 1, 1)
|
||||||
|
@ -7,7 +7,7 @@ from mongoengine import signals
|
|||||||
signal_output = []
|
signal_output = []
|
||||||
|
|
||||||
|
|
||||||
class SignalTests(unittest.TestCase):
|
class TestSignal(unittest.TestCase):
|
||||||
"""
|
"""
|
||||||
Testing signals before/after saving and deleting.
|
Testing signals before/after saving and deleting.
|
||||||
"""
|
"""
|
||||||
|
@ -8,7 +8,7 @@ from mongoengine.base.utils import LazyRegexCompiler
|
|||||||
signal_output = []
|
signal_output = []
|
||||||
|
|
||||||
|
|
||||||
class LazyRegexCompilerTest(unittest.TestCase):
|
class TestLazyRegexCompiler:
|
||||||
def test_lazy_regex_compiler_verify_laziness_of_descriptor(self):
|
def test_lazy_regex_compiler_verify_laziness_of_descriptor(self):
|
||||||
class UserEmail(object):
|
class UserEmail(object):
|
||||||
EMAIL_REGEX = LazyRegexCompiler("@", flags=32)
|
EMAIL_REGEX = LazyRegexCompiler("@", flags=32)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user