New submission from Larry Hastings:

If you run Lib/test/test_userdict.py enough times, sooner or later it'll 
produce a spurious error.  I wrote a shell script that ran "./python -m test 
test_userdict" a zillion times; here's a snippet of output from running that 
script:

[...]
1 test OK.
[1/1] test_userdict
1 test OK.
[1/1] test_userdict
1 test OK.
[1/1] test_userdict
test test_userdict failed -- Traceback (most recent call last):
  File "/home/larry/src/python/clinic/Lib/test/test_userdict.py", line 48, in 
test_all
    self.assertEqual(repr(u2), repr(d2))
AssertionError: "{'one': 1, 'two': 2}" != "{'two': 2, 'one': 1}"
- {'one': 1, 'two': 2}
+ {'two': 2, 'one': 1}


1 test failed:
    test_userdict
[1/1] test_userdict
1 test OK.
[1/1] test_userdict
1 test OK.
[...]

Line 48 reads as follows:
    self.assertEqual(repr(u2), repr(d2))

I realize this code is ancient--but it seems to rely on repr of a dict 
producing consistent output, which is silly and has always been wrong.

Raymond, you want to take this?

----------
components: Library (Lib)
messages: 203509
nosy: larry, rhettinger
priority: normal
severity: normal
stage: needs patch
status: open
title: UserDict test assumes ordered dict repr
type: behavior
versions: Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19664>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to