source: ralphm-patches/py3-test-helpers.patch

Last change on this file was 78:361e2111a663, checked in by Ralph Meijer <ralphm@…>, 6 years ago

Start port to Python 3.

File size: 1.1 KB
RevLine 
[78]1# HG changeset patch
2# Parent  b7bf25ca839d7ac87cc565a0374110c49de27d18
3
4diff --git a/wokkel/test/helpers.py b/wokkel/test/helpers.py
5--- a/wokkel/test/helpers.py
6+++ b/wokkel/test/helpers.py
7@@ -5,7 +5,10 @@
8 Unit test helpers.
9 """
10 
11+from __future__ import division, absolute_import
12+
13 from twisted.internet import defer
14+from twisted.python.compat import iteritems
15 from twisted.words.xish import xpath
16 from twisted.words.xish.utility import EventDispatcher
17 
18@@ -34,7 +37,7 @@
19         >>> stub.output[-1].toXml()
20         u'<presence/>'
21         >>> def cb(stanza):
22-        ...     print "Got: %r" stanza.toXml()
23+        ...     print("Got: %r" stanza.toXml())
24         >>> stub.xmlstream.addObserver('/presence')
25         >>> stub.send(domish.Element((None, 'presence')))
26         Got: u'<presence/>'
27@@ -83,7 +86,7 @@
28         """
29         handler = None
30         iq = parseXml(xml)
31-        for queryString, method in self.service.iqHandlers.iteritems():
32+        for queryString, method in iteritems(self.service.iqHandlers):
33             if xpath.internQuery(queryString).matches(iq):
34                 handler = getattr(self.service, method)
35 
Note: See TracBrowser for help on using the repository browser.