1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Refs #24621 -- Added a test for SessionBase.pop()'s 'default' argument.

This commit is contained in:
Nicolas Noé 2016-04-20 17:04:58 +02:00 committed by Tim Graham
parent 08cd6a0e56
commit 973f393761

View File

@ -83,6 +83,11 @@ class SessionTestsMixin(object):
self.assertTrue(self.session.accessed) self.assertTrue(self.session.accessed)
self.assertFalse(self.session.modified) self.assertFalse(self.session.modified)
def test_pop_default_named_argument(self):
self.assertEqual(self.session.pop('some key', default='does not exist'), 'does not exist')
self.assertTrue(self.session.accessed)
self.assertFalse(self.session.modified)
def test_setdefault(self): def test_setdefault(self):
self.assertEqual(self.session.setdefault('foo', 'bar'), 'bar') self.assertEqual(self.session.setdefault('foo', 'bar'), 'bar')
self.assertEqual(self.session.setdefault('foo', 'baz'), 'bar') self.assertEqual(self.session.setdefault('foo', 'baz'), 'bar')