Skip to content

Commit

Permalink
'Refactored by Sourcery'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sourcery AI committed Jul 1, 2023
1 parent c49fa0d commit cd1104c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -546,12 +546,15 @@ async def test_lazy_load(item_repo: ItemAsyncRepository, tag_repo: TagAsyncRepos
assert len(new_items) > 0
first_item_id = new_items[0].id
new_items[1].id
update_data = {"name": "A modified Name", "tag_names": ["A new tag"]}
update_data.update({"id": first_item_id}) # type: ignore
update_data = {
"name": "A modified Name",
"tag_names": ["A new tag"],
"id": first_item_id,
}
tags_to_add = await maybe_async(tag_repo.list(CollectionFilter("name", update_data.pop("tag_names", []))))
assert len(tags_to_add) > 0
assert tags_to_add[0].id is not None
update_data.update({"tags": tags_to_add}) # type: ignore
update_data["tags"] = tags_to_add
updated_obj = await maybe_async(item_repo.update(BigIntItem(**update_data)))
await maybe_async(item_repo.session.commit())
assert len(updated_obj.tags) > 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -652,12 +652,15 @@ async def test_lazy_load(item_repo: ItemAsyncRepository, tag_repo: TagAsyncRepos
assert len(new_items) > 0
first_item_id = new_items[0].id
new_items[1].id
update_data = {"name": "A modified Name", "tag_names": ["A new tag"]}
update_data.update({"id": first_item_id}) # type: ignore
update_data = {
"name": "A modified Name",
"tag_names": ["A new tag"],
"id": first_item_id,
}
tags_to_add = await maybe_async(tag_repo.list(CollectionFilter("name", update_data.pop("tag_names", []))))
assert len(tags_to_add) > 0
assert tags_to_add[0].id is not None
update_data.update({"tags": tags_to_add}) # type: ignore
update_data["tags"] = tags_to_add
updated_obj = await maybe_async(item_repo.update(UUIDItem(**update_data)))
await maybe_async(item_repo.session.commit())
assert len(updated_obj.tags) > 0
Expand Down

0 comments on commit cd1104c

Please sign in to comment.