Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[1.5.x] Fixed test failures on Python 3.3 due to dict ordering assump…

…tions.

Refs #19038

Backport of c229f31118bd8a7494692a727860ed7cb58df232 from master
  • Loading branch information...
commit 0efca2a8198f5e7a702c0fbb38be489a6bd23ef5 1 parent f02f29d
Luke Plant spookylukey authored
Showing with 9 additions and 10 deletions.
  1. +9 −10 tests/regressiontests/utils/datastructures.py
19 tests/regressiontests/utils/datastructures.py
View
@@ -212,19 +212,18 @@ def test_multivaluedict(self):
self.assertEqual(d['name'], 'Simon')
self.assertEqual(d.get('name'), 'Simon')
self.assertEqual(d.getlist('name'), ['Adrian', 'Simon'])
- self.assertEqual(list(six.iteritems(d)),
- [('position', 'Developer'), ('name', 'Simon')])
+ self.assertEqual(sorted(list(six.iteritems(d))),
+ [('name', 'Simon'), ('position', 'Developer')])
- self.assertEqual(list(six.iterlists(d)),
- [('position', ['Developer']),
- ('name', ['Adrian', 'Simon'])])
+ self.assertEqual(sorted(list(six.iterlists(d))),
+ [('name', ['Adrian', 'Simon']),
+ ('position', ['Developer'])])
# MultiValueDictKeyError: "Key 'lastname' not found in
# <MultiValueDict: {'position': ['Developer'],
# 'name': ['Adrian', 'Simon']}>"
- self.assertRaisesMessage(MultiValueDictKeyError,
- '"Key \'lastname\' not found in <MultiValueDict: {\'position\':'\
- ' [\'Developer\'], \'name\': [\'Adrian\', \'Simon\']}>"',
+ self.assertRaisesRegex(MultiValueDictKeyError,
+ r'"Key \'lastname\' not found in <MultiValueDict',
d.__getitem__, 'lastname')
self.assertEqual(d.get('lastname'), None)
@@ -235,8 +234,8 @@ def test_multivaluedict(self):
d.setlist('lastname', ['Holovaty', 'Willison'])
self.assertEqual(d.getlist('lastname'), ['Holovaty', 'Willison'])
- self.assertEqual(list(six.itervalues(d)),
- ['Developer', 'Simon', 'Willison'])
+ self.assertEqual(sorted(list(six.itervalues(d))),
+ ['Developer', 'Simon', 'Willison'])
def test_appendlist(self):
d = MultiValueDict()
Please sign in to comment.
Something went wrong with that request. Please try again.