From 7be94e033557ec984f53f8a67bd3326ee5a83b4a Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Thu, 27 Apr 2017 05:16:19 -0700 Subject: Replaced set |= operator with update() to avoid temporary set. --- django/test/utils.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'django/test') diff --git a/django/test/utils.py b/django/test/utils.py index efd1b49c88..9ba24a3e77 100644 --- a/django/test/utils.py +++ b/django/test/utils.py @@ -7,6 +7,7 @@ import warnings from contextlib import contextmanager from functools import wraps from io import StringIO +from itertools import chain from types import SimpleNamespace from unittest import TestCase, skipIf, skipUnless from xml.dom.minidom import Node, parseString @@ -85,11 +86,7 @@ class ContextList(list): """ Flattened keys of subcontexts. """ - keys = set() - for subcontext in self: - for dict in subcontext: - keys |= set(dict.keys()) - return keys + return set(chain.from_iterable(d for subcontext in self for d in subcontext)) def instrumented_test_render(self, context): -- cgit v1.3