mirror of https://github.com/django/django.git
[1.5.x] Fixed test failures on Python 3.3 due to dict ordering assumptions.
Refs #19038 Backport of c229f31118bd8a7494692a727860ed7cb58df232 from master
This commit is contained in:
parent
f02f29dccc
commit
0efca2a819
|
@ -212,19 +212,18 @@ class MultiValueDictTests(SimpleTestCase):
|
||||||
self.assertEqual(d['name'], 'Simon')
|
self.assertEqual(d['name'], 'Simon')
|
||||||
self.assertEqual(d.get('name'), 'Simon')
|
self.assertEqual(d.get('name'), 'Simon')
|
||||||
self.assertEqual(d.getlist('name'), ['Adrian', 'Simon'])
|
self.assertEqual(d.getlist('name'), ['Adrian', 'Simon'])
|
||||||
self.assertEqual(list(six.iteritems(d)),
|
self.assertEqual(sorted(list(six.iteritems(d))),
|
||||||
[('position', 'Developer'), ('name', 'Simon')])
|
[('name', 'Simon'), ('position', 'Developer')])
|
||||||
|
|
||||||
self.assertEqual(list(six.iterlists(d)),
|
self.assertEqual(sorted(list(six.iterlists(d))),
|
||||||
[('position', ['Developer']),
|
[('name', ['Adrian', 'Simon']),
|
||||||
('name', ['Adrian', 'Simon'])])
|
('position', ['Developer'])])
|
||||||
|
|
||||||
# MultiValueDictKeyError: "Key 'lastname' not found in
|
# MultiValueDictKeyError: "Key 'lastname' not found in
|
||||||
# <MultiValueDict: {'position': ['Developer'],
|
# <MultiValueDict: {'position': ['Developer'],
|
||||||
# 'name': ['Adrian', 'Simon']}>"
|
# 'name': ['Adrian', 'Simon']}>"
|
||||||
self.assertRaisesMessage(MultiValueDictKeyError,
|
self.assertRaisesRegex(MultiValueDictKeyError,
|
||||||
'"Key \'lastname\' not found in <MultiValueDict: {\'position\':'\
|
r'"Key \'lastname\' not found in <MultiValueDict',
|
||||||
' [\'Developer\'], \'name\': [\'Adrian\', \'Simon\']}>"',
|
|
||||||
d.__getitem__, 'lastname')
|
d.__getitem__, 'lastname')
|
||||||
|
|
||||||
self.assertEqual(d.get('lastname'), None)
|
self.assertEqual(d.get('lastname'), None)
|
||||||
|
@ -235,7 +234,7 @@ class MultiValueDictTests(SimpleTestCase):
|
||||||
|
|
||||||
d.setlist('lastname', ['Holovaty', 'Willison'])
|
d.setlist('lastname', ['Holovaty', 'Willison'])
|
||||||
self.assertEqual(d.getlist('lastname'), ['Holovaty', 'Willison'])
|
self.assertEqual(d.getlist('lastname'), ['Holovaty', 'Willison'])
|
||||||
self.assertEqual(list(six.itervalues(d)),
|
self.assertEqual(sorted(list(six.itervalues(d))),
|
||||||
['Developer', 'Simon', 'Willison'])
|
['Developer', 'Simon', 'Willison'])
|
||||||
|
|
||||||
def test_appendlist(self):
|
def test_appendlist(self):
|
||||||
|
|
Loading…
Reference in New Issue