From 5e6307f2407fb8faadb3e7b7d8662e82b72b0e52 Mon Sep 17 00:00:00 2001 From: Roman Wu Date: Mon, 18 Aug 2025 02:23:02 -0400 Subject: [PATCH] refactor: Rename 'dict' to 'dict_field' in EmbeddedJsonModelWithDict for clarity --- tests/conftest.py | 7 ------- tests/test_json_model.py | 6 +++--- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 9f067a38..95d0fcf7 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -17,13 +17,6 @@ def py_test_mark_sync(f): return f # no-op decorator -@pytest.fixture(scope="session") -def event_loop(request): - loop = asyncio.get_event_loop_policy().new_event_loop() - yield loop - loop.close() - - @pytest.fixture(scope="session") def redis(): yield get_redis_connection() diff --git a/tests/test_json_model.py b/tests/test_json_model.py index 5474eb7a..61672fab 100644 --- a/tests/test_json_model.py +++ b/tests/test_json_model.py @@ -1134,7 +1134,7 @@ class TestUpdatesClass(JsonModel, index=True): @py_test_mark_asyncio async def test_model_with_dict(): class EmbeddedJsonModelWithDict(EmbeddedJsonModel, index=True): - dict: Dict + dict_field: Dict class ModelWithDict(JsonModel, index=True): embedded_model: EmbeddedJsonModelWithDict @@ -1145,14 +1145,14 @@ class ModelWithDict(JsonModel, index=True): inner_dict = dict() d["foo"] = "bar" inner_dict["bar"] = "foo" - embedded_model = EmbeddedJsonModelWithDict(dict=inner_dict) + embedded_model = EmbeddedJsonModelWithDict(dict_field=inner_dict) item = ModelWithDict(info=d, embedded_model=embedded_model) await item.save() rematerialized = await ModelWithDict.find(ModelWithDict.pk == item.pk).first() assert rematerialized.pk == item.pk assert rematerialized.info["foo"] == "bar" - assert rematerialized.embedded_model.dict["bar"] == "foo" + assert rematerialized.embedded_model.dict_field["bar"] == "foo" @py_test_mark_asyncio