Skip to content

Commit 06a6062

Browse files
Use immutable default value to prevent state leak between calls
1 parent 9794997 commit 06a6062

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tests/test_relationships.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ def _category_product_ids_via_subcategories(self, category_id):
4242
assert category is not None
4343
return sorted({product.id for subcategory in category.subcategories for product in subcategory.products.all()})
4444

45-
def _assert_related_collection(self, resp, key, expected_ids=[], status_code=200):
45+
def _assert_related_collection(self, resp, key, expected_ids=None, status_code=200):
4646
assert resp.status_code == status_code
4747
data = resp.get_json()
4848
assert key in data
4949
returned_ids = sorted([item["id"] for item in data[key]])
50+
expected_ids = expected_ids or []
5051
assert returned_ids == sorted(expected_ids)
5152

5253
def test_create_category_with_subcategories(self, create_category, create_subcategory):

0 commit comments

Comments
 (0)