mirror of
https://github.com/django/django.git
synced 2025-08-18 01:30:42 +00:00
Fixed #7496 -- It's now possible to pickle SortedDicts with pickle protocol 2
(used in caching). Thanks, John Huddleston. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8531 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
d62cfce213
commit
62b39322f3
3 changed files with 12 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
"""
|
||||
# Tests for stuff in django.utils.datastructures.
|
||||
|
||||
>>> import pickle
|
||||
>>> from django.utils.datastructures import *
|
||||
|
||||
### MergeDict #################################################################
|
||||
|
@ -103,13 +104,16 @@ Init from sequence of tuples
|
|||
>>> print repr(d)
|
||||
{1: 'one', 0: 'zero', 2: 'two'}
|
||||
|
||||
>>> pickle.loads(pickle.dumps(d, 2))
|
||||
{1: 'one', 0: 'zero', 2: 'two'}
|
||||
|
||||
>>> d.clear()
|
||||
>>> d
|
||||
{}
|
||||
>>> d.keyOrder
|
||||
[]
|
||||
|
||||
### DotExpandedDict ############################################################
|
||||
### DotExpandedDict ##########################################################
|
||||
|
||||
>>> d = DotExpandedDict({'person.1.firstname': ['Simon'], 'person.1.lastname': ['Willison'], 'person.2.firstname': ['Adrian'], 'person.2.lastname': ['Holovaty']})
|
||||
>>> d['person']['1']['lastname']
|
||||
|
@ -119,7 +123,7 @@ Init from sequence of tuples
|
|||
>>> d['person']['2']['firstname']
|
||||
['Adrian']
|
||||
|
||||
### ImmutableList ################################################################
|
||||
### ImmutableList ############################################################
|
||||
>>> d = ImmutableList(range(10))
|
||||
>>> d.sort()
|
||||
Traceback (most recent call last):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue