Skip to content

refactor: Rename 'dict' to 'dict_field' in EmbeddedJsonModelWithDict … #710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions tests/test_json_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down