summaryrefslogtreecommitdiff
path: root/django/test
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2017-04-27 05:16:19 -0700
committerTim Graham <timograham@gmail.com>2017-04-27 08:16:19 -0400
commit7be94e033557ec984f53f8a67bd3326ee5a83b4a (patch)
tree0c6116f0fb53adb0dcc17d81ecaeb8e1a4742a9d /django/test
parent59f8118c86af7641f23a9f2c2e0812c8b1ba47dd (diff)
Replaced set |= operator with update() to avoid temporary set.
Diffstat (limited to 'django/test')
-rw-r--r--django/test/utils.py7
1 files changed, 2 insertions, 5 deletions
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):