mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Fixed #3616 -- Added some more data structure tests from Chris McAvoy.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4684 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
4823a531d1
commit
7d8687ea35
@ -31,4 +31,33 @@
|
||||
'nonexistent'
|
||||
>>> d.setlist('lastname', ['Holovaty', 'Willison'])
|
||||
|
||||
"""
|
||||
### SortedDict #################################################################
|
||||
|
||||
>>> d = SortedDict()
|
||||
>>> d['one'] = 'one'
|
||||
>>> d['two'] = 'two'
|
||||
>>> d['three'] = 'three'
|
||||
>>> d['one']
|
||||
'one'
|
||||
>>> d['two']
|
||||
'two'
|
||||
>>> d['three']
|
||||
'three'
|
||||
>>> d.keys()
|
||||
['one', 'two', 'three']
|
||||
>>> d.values()
|
||||
['one', 'two', 'three']
|
||||
>>> d['one'] = 'not one'
|
||||
>>> d['one']
|
||||
'not one'
|
||||
|
||||
### DotExpandedDict ############################################################
|
||||
|
||||
>>> d = DotExpandedDict({'person.1.firstname': ['Simon'], 'person.1.lastname': ['Willison'], 'person.2.firstname': ['Adrian'], 'person.2.lastname': ['Holovaty']})
|
||||
>>> d['person']['1']['lastname']
|
||||
['Willison']
|
||||
>>> d['person']['2']['lastname']
|
||||
['Holovaty']
|
||||
>>> d['person']['2']['firstname']
|
||||
['Adrian']
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user