summaryrefslogtreecommitdiff
path: root/django/test/utils.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2017-01-06 19:23:42 -0500
committerGitHub <noreply@github.com>2017-01-06 19:23:42 -0500
commit8516f7c49bfaeb1fa75d16509e05ba5d0933dc58 (patch)
tree11e31c193419335725da753c993bbdb843b2e691 /django/test/utils.py
parent12cefee5d84b3569ccbde03167c7853e8dac638f (diff)
downloaddjango-8516f7c49bfaeb1fa75d16509e05ba5d0933dc58.tar.gz
Fixed #27698 -- Added django.test.utils.ContextList.get()
Diffstat (limited to 'django/test/utils.py')
-rw-r--r--django/test/utils.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/django/test/utils.py b/django/test/utils.py
index b846fa2655..b24f2e8c80 100644
--- a/django/test/utils.py
+++ b/django/test/utils.py
@@ -74,6 +74,12 @@ class ContextList(list):
else:
return super(ContextList, self).__getitem__(key)
+ def get(self, key, default=None):
+ try:
+ return self.__getitem__(key)
+ except KeyError:
+ return default
+
def __contains__(self, key):
try:
self[key]