[Telepathy] [Bug 18179] New: __repr__ hack for domish.Element doesn' t work because assert uses str()
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Wed Oct 22 08:20:15 PDT 2008
http://bugs.freedesktop.org/show_bug.cgi?id=18179
Summary: __repr__ hack for domish.Element doesn't work because
assert uses str()
Product: Telepathy
Version: unspecified
Platform: Other
OS/Version: All
Status: NEW
Severity: normal
Priority: medium
Component: telepathy-gabble
AssignedTo: telepathy at lists.freedesktop.org
ReportedBy: will.thompson at collabora.co.uk
servicetest.py contains the following:
# hack to ease debugging
domish.Element.__repr__ = domish.Element.toXml
The intention is that code like:
assert element['foo'] == bar, element
should produce the stringified xml of element when the assertion fails. This
does not in fact work, as assert uses str() not repr().
Overriding __str__ in the same way yields bizarro exceptions:
Traceback (most recent call last):
File "/build/buildd/python2.4-2.4.5/Modules/pyexpat.c", line 639, in
EndElement
File "/usr/lib/python2.4/site-packages/twisted/words/xish/domish.py", line
780, in _onEndElement
self.ElementEvent(self.currElem)
File "/usr/lib/python2.4/site-packages/twisted/words/xish/xmlstream.py", line
106, in onElement
self.dispatch(element)
File "/usr/lib/python2.4/site-packages/twisted/words/xish/utility.py", line
316, in dispatch
callbacklist.callback(obj)
--- <exception caught here> ---
File "/usr/lib/python2.4/site-packages/twisted/words/xish/utility.py", line
106, in callback
methodwrapper(*args, **kwargs)
File "/usr/lib/python2.4/site-packages/twisted/words/xish/utility.py", line
27, in __call__
self.method(*nargs, **nkwargs)
File "/home/will/src/Telepathy/telepathy-gabble/tests/twisted/gabbletest.py",
line 75, in secondIq
assert map(str, username) == [self.username]
exceptions.AssertionError:
Traceback (most recent call last):
File "/home/will/src/Telepathy/telepathy-gabble/tests/twisted/gabbletest.py",
line 316, in exec_test_deferred
fun(queue, bus, conn, stream)
File "./muc/test-muc.py", line 16, in test
q.expect('dbus-signal', signal='StatusChanged', args=[0, 1])
File
"/home/will/src/Telepathy/telepathy-gabble/tests/twisted/servicetest.py", line
217, in expect
event = self.wait()
File
"/home/will/src/Telepathy/telepathy-gabble/tests/twisted/servicetest.py", line
286, in wait
raise TimeoutError
TimeoutError
--
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the Telepathy
mailing list