diff --git a/tests/queryset/test_field_list.py b/tests/queryset/test_field_list.py index fbdde23b..be7903fd 100644 --- a/tests/queryset/test_field_list.py +++ b/tests/queryset/test_field_list.py @@ -6,7 +6,7 @@ from mongoengine import * from mongoengine.queryset import QueryFieldList -class TestQueryFieldList(unittest.TestCase): +class TestQueryFieldList: def test_empty(self): q = QueryFieldList() assert not q diff --git a/tests/test_common.py b/tests/test_common.py index 6b6f18de..1779a91b 100644 --- a/tests/test_common.py +++ b/tests/test_common.py @@ -6,7 +6,7 @@ from mongoengine import Document from mongoengine.common import _import_class -class TestCommon(unittest.TestCase): +class TestCommon: def test__import_class(self): doc_cls = _import_class("Document") assert doc_cls is Document diff --git a/tests/test_context_managers.py b/tests/test_context_managers.py index d68afbb0..c10a0224 100644 --- a/tests/test_context_managers.py +++ b/tests/test_context_managers.py @@ -14,7 +14,7 @@ from mongoengine.context_managers import ( from mongoengine.pymongo_support import count_documents -class ContextManagersTest(unittest.TestCase): +class TestContextManagers: def test_switch_db_context_manager(self): connect("mongoenginetest") register_connection("testdb-1", "mongoenginetest2") diff --git a/tests/test_datastructures.py b/tests/test_datastructures.py index ad421a72..7b5d7d11 100644 --- a/tests/test_datastructures.py +++ b/tests/test_datastructures.py @@ -15,7 +15,7 @@ class DocumentStub(object): self._changed_fields.append(key) -class TestBaseDict(unittest.TestCase): +class TestBaseDict: @staticmethod def _get_basedict(dict_items): """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"] -class TestBaseList(unittest.TestCase): +class TestBaseList: @staticmethod def _get_baselist(list_items): """Get a BaseList bound to a fake document instance""" @@ -360,12 +360,12 @@ class TestBaseList(unittest.TestCase): class TestStrictDict(unittest.TestCase): - def strict_dict_class(self, *args, **kwargs): - return StrictDict.create(*args, **kwargs) - def setUp(self): 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): d = self.dtype(a=1, b=1, c=1) assert (d.a, d.b, d.c) == (1, 1, 1) diff --git a/tests/test_signals.py b/tests/test_signals.py index b217712b..d79eaf75 100644 --- a/tests/test_signals.py +++ b/tests/test_signals.py @@ -7,7 +7,7 @@ from mongoengine import signals signal_output = [] -class SignalTests(unittest.TestCase): +class TestSignal(unittest.TestCase): """ Testing signals before/after saving and deleting. """ diff --git a/tests/test_utils.py b/tests/test_utils.py index ef396571..dd178273 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -8,7 +8,7 @@ from mongoengine.base.utils import LazyRegexCompiler signal_output = [] -class LazyRegexCompilerTest(unittest.TestCase): +class TestLazyRegexCompiler: def test_lazy_regex_compiler_verify_laziness_of_descriptor(self): class UserEmail(object): EMAIL_REGEX = LazyRegexCompiler("@", flags=32)