Skip to content

Executed pyupgrade with --py3-only #1023

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

Merged
merged 2 commits into from
Dec 7, 2021
Merged
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
22 changes: 8 additions & 14 deletions example/tests/integration/test_includes.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_included_data_on_list(multiple_entries, client):
comment_count = len(
[resource for resource in included if resource["type"] == "comments"]
)
expected_comment_count = sum([entry.comments.count() for entry in multiple_entries])
expected_comment_count = sum(entry.comments.count() for entry in multiple_entries)
assert comment_count == expected_comment_count, "List comment count is incorrect"


Expand Down Expand Up @@ -135,28 +135,24 @@ def test_deep_included_data_on_list(multiple_entries, client):
comment_count = len(
[resource for resource in included if resource["type"] == "comments"]
)
expected_comment_count = sum([entry.comments.count() for entry in multiple_entries])
expected_comment_count = sum(entry.comments.count() for entry in multiple_entries)
assert comment_count == expected_comment_count, "List comment count is incorrect"

author_count = len(
[resource for resource in included if resource["type"] == "authors"]
)
expected_author_count = sum(
[
entry.comments.filter(author__isnull=False).count()
for entry in multiple_entries
]
entry.comments.filter(author__isnull=False).count()
for entry in multiple_entries
)
assert author_count == expected_author_count, "List author count is incorrect"

author_bio_count = len(
[resource for resource in included if resource["type"] == "authorBios"]
)
expected_author_bio_count = sum(
[
entry.comments.filter(author__bio__isnull=False).count()
for entry in multiple_entries
]
entry.comments.filter(author__bio__isnull=False).count()
for entry in multiple_entries
)
assert (
author_bio_count == expected_author_bio_count
Expand All @@ -166,10 +162,8 @@ def test_deep_included_data_on_list(multiple_entries, client):
[resource for resource in included if resource["type"] == "writers"]
)
expected_writer_count = sum(
[
entry.comments.filter(author__isnull=False).count()
for entry in multiple_entries
]
entry.comments.filter(author__isnull=False).count()
for entry in multiple_entries
)
assert writer_count == expected_writer_count, "List writer count is incorrect"

Expand Down
28 changes: 13 additions & 15 deletions example/tests/integration/test_polymorphism.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ def test_polymorphism_on_detail_relations(single_company, client):
content["data"]["relationships"]["currentProject"]["data"]["type"]
== "artProjects"
)
assert set(
[
rel["type"]
for rel in content["data"]["relationships"]["futureProjects"]["data"]
]
) == set(["researchProjects", "artProjects"])
assert {
rel["type"]
for rel in content["data"]["relationships"]["futureProjects"]["data"]
} == {"researchProjects", "artProjects"}


def test_polymorphism_on_included_relations(single_company, client):
Expand All @@ -47,15 +45,15 @@ def test_polymorphism_on_included_relations(single_company, client):
== "artProjects"
)
assert content["data"]["relationships"]["currentResearchProject"]["data"] is None
assert set(
[
rel["type"]
for rel in content["data"]["relationships"]["futureProjects"]["data"]
]
) == set(["researchProjects", "artProjects"])
assert set([x.get("type") for x in content.get("included")]) == set(
["artProjects", "artProjects", "researchProjects"]
), "Detail included types are incorrect"
assert {
rel["type"]
for rel in content["data"]["relationships"]["futureProjects"]["data"]
} == {"researchProjects", "artProjects"}
assert {x.get("type") for x in content.get("included")} == {
"artProjects",
"artProjects",
"researchProjects",
}, "Detail included types are incorrect"
# Ensure that the child fields are present.
assert content.get("included")[0].get("attributes").get("artist") is not None
assert content.get("included")[1].get("attributes").get("artist") is not None
Expand Down
2 changes: 1 addition & 1 deletion example/tests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ def test_search_multiple_keywords(self):
expected_ids = set.intersection(*union)
expected_len = len(expected_ids)
self.assertEqual(len(dja_response["data"]), expected_len)
returned_ids = set([k["id"] for k in dja_response["data"]])
returned_ids = {k["id"] for k in dja_response["data"]}
self.assertEqual(returned_ids, expected_ids)

def test_param_invalid(self):
Expand Down