test_util: tolerate unordered repr of NumDict

NumDict does not make any claims about the order of its repr(), so the
test needs to be prepared for it to be stringified in any order. On unix
the old test happened to pass, but on certain windows boxes (maybe
certain versions of python?), it failed. Fixes ticket:2736.
This commit is contained in:
Brian Warner 2016-02-23 10:51:25 -08:00
parent 428ca04e2c
commit 28f2a0f12d
1 changed files with 2 additions and 1 deletions

View File

@ -1353,7 +1353,8 @@ class DictUtil(unittest.TestCase):
self.failUnlessEqual(d.item_with_largest_value(), ("b", 6))
d = dictutil.NumDict({"a": 1, "b": 2})
self.failUnlessEqual(repr(d), "{'a': 1, 'b': 2}")
self.failUnlessIn(repr(d), ("{'a': 1, 'b': 2}",
"{'b': 2, 'a': 1}"))
self.failUnless("a" in d)
d2 = dictutil.NumDict({"c": 3, "d": 4})