Mercurial > sat_tmp
changeset 69:0721b6254c9e
python 3 port:
- applied 2to3
- replaced zope's implements by @implementer decorator
- replaced references to python2 by python3
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 13 Aug 2019 18:58:11 +0200 |
parents | 042a926cf3b2 |
children | 922b2f0efa60 |
files | sat_tmp/wokkel/data_form.py sat_tmp/wokkel/mam.py sat_tmp/wokkel/pubsub.py sat_tmp/wokkel/rsm.py sat_tmp/wokkel/test/test_pubsub.py sat_tmp/wokkel/test/test_rsm.py setup.py |
diffstat | 7 files changed, 449 insertions(+), 449 deletions(-) [+] |
line wrap: on
line diff
--- a/sat_tmp/wokkel/data_form.py Tue Aug 13 18:58:08 2019 +0200 +++ b/sat_tmp/wokkel/data_form.py Tue Aug 13 18:58:11 2019 +0200 @@ -20,7 +20,7 @@ from wokkel import data_form from twisted.words.xish import domish -NS_XML_ELEMENT = u"urn:xmpp:xml-element" +NS_XML_ELEMENT = "urn:xmpp:xml-element" class Field(data_form.Field): @@ -49,7 +49,7 @@ raise ValueError('extended type must have one and only one value') if self.options: raise ValueError('options must not be set for extented type') - if self.ext_type == u'xml': + if self.ext_type == 'xml': if not isinstance(self.value, domish.Element): raise ValueError('invalid value, a domish.Element is expected') else: @@ -69,7 +69,7 @@ if self.var is not None: field_elt['var'] = self.var - wrapper_elt = field_elt.addElement((NS_XML_ELEMENT, u'wrapper')) + wrapper_elt = field_elt.addElement((NS_XML_ELEMENT, 'wrapper')) wrapper_elt.addChild(self.value) if asForm: @@ -88,7 +88,7 @@ def fromElement(element): field = super(Field, Field).fromElement(element) if element.wrapper and element.wrapper.uri == NS_XML_ELEMENT: - field.ext_type = u"xml" + field.ext_type = "xml" field.value = element.wrapper.firstChildElement() return field
--- a/sat_tmp/wokkel/mam.py Tue Aug 13 18:58:08 2019 +0200 +++ b/sat_tmp/wokkel/mam.py Tue Aug 13 18:58:11 2019 +0200 @@ -27,7 +27,7 @@ from dateutil import tz -from zope.interface import implements +from zope.interface import implementer from zope.interface import Interface from twisted.words.protocols.jabber import xmlstream @@ -42,11 +42,11 @@ from wokkel import data_form from wokkel import delay -import rsm +from . import rsm NS_MAM = 'urn:xmpp:mam:2' NS_FORWARD = 'urn:xmpp:forward:0' -NS_ORDER_BY = u"urn:xmpp:order-by:0" +NS_ORDER_BY = "urn:xmpp:order-by:0" FIELDS_REQUEST = "/iq[@type='get']/query[@xmlns='%s']" % NS_MAM ARCHIVE_REQUEST = "/iq[@type='set']/query[@xmlns='%s']" % NS_MAM @@ -125,7 +125,7 @@ sender = jid.JID(iq.getAttribute('from')) recipient = jid.JID(iq.getAttribute('to')) try: - query = iq.elements(NS_MAM, 'query').next() + query = next(iq.elements(NS_MAM, 'query')) except StopIteration: raise MAMError("Can't find MAM <query/> in element") form = data_form.findForm(query, NS_MAM) @@ -231,7 +231,7 @@ for attr in ('always', 'never'): prefs[attr] = [] try: - pref = prefs_elt.elements(NS_MAM, attr).next() + pref = next(prefs_elt.elements(NS_MAM, attr)) except StopIteration: # FIXME: return proper error here raise MAMError('Element provided is not a valid MAM <prefs/> request') @@ -296,7 +296,7 @@ iq = xmlstream.IQ(self.xmlstream, 'set') mam_query.render(iq) if sender is not None: - iq['from'] = unicode(sender) + iq['from'] = str(sender) return iq.send(to=service.full() if service else None) def queryFields(self, service=None, sender=None): @@ -315,9 +315,9 @@ iq = xmlstream.IQ(self.xmlstream, 'get') MAMRequest().render(iq) if sender is not None: - iq['from'] = unicode(sender) + iq['from'] = str(sender) d = iq.send(to=service.full() if service else None) - d.addCallback(lambda iq_result: iq_result.elements(NS_MAM, 'query').next()) + d.addCallback(lambda iq_result: next(iq_result.elements(NS_MAM, 'query'))) d.addCallback(data_form.findForm, NS_MAM) return d @@ -337,7 +337,7 @@ iq = xmlstream.IQ(self.xmlstream, 'get') MAMPrefs().render(iq) if sender is not None: - iq['from'] = unicode(sender) + iq['from'] = str(sender) return iq.send(to=service.full() if service else None) def setPrefs(self, service=None, default='roster', always=None, never=None, sender=None): @@ -366,7 +366,7 @@ iq = xmlstream.IQ(self.xmlstream, 'set') MAMPrefs(default, always, never).render(iq) if sender is not None: - iq['from'] = unicode(sender) + iq['from'] = str(sender) return iq.send(to=service.full() if service else None) @@ -419,13 +419,13 @@ """ +@implementer(IMAMService, disco.IDisco) class MAMService(subprotocols.XMPPHandler, subprotocols.IQHandlerMixin): """ Protocol implementation for a MAM service. This handler waits for XMPP Ping requests and sends a response. """ - implements(IMAMService, disco.IDisco) _request_class = MAMRequest @@ -505,7 +505,7 @@ # remove unsupported filters unsupported_fields = [] if mam_.form: - for key, field in mam_.form.fields.iteritems(): + for key, field in mam_.form.fields.items(): if key not in self._mainFilters and key not in self.extra_fields: log.msg('Ignored unsupported MAM filter: %s' % field) unsupported_fields.append(key) @@ -530,7 +530,7 @@ forwardMessage(*data) fin_elt = domish.Element((NS_MAM, 'fin')) - for key, value in attributes.items(): + for key, value in list(attributes.items()): fin_elt[key] = value if rsm_elt is not None: @@ -620,7 +620,7 @@ form = data_form.Form(formType, formNamespace=NS_MAM) if formType == 'form': - for kwargs in MAMService._mainFilters.values(): + for kwargs in list(MAMService._mainFilters.values()): form.addField(data_form.Field(**kwargs)) elif formType == 'submit': if start:
--- a/sat_tmp/wokkel/pubsub.py Tue Aug 13 18:58:08 2019 +0200 +++ b/sat_tmp/wokkel/pubsub.py Tue Aug 13 18:58:11 2019 +0200 @@ -56,7 +56,7 @@ U{XEP-0060<http://xmpp.org/extensions/xep-0060.html>}. """ -from zope.interface import implements +from zope.interface import implementer from twisted.internet import defer from twisted.python import log @@ -81,7 +81,7 @@ NS_PUBSUB_META_DATA = NS_PUBSUB + "#meta-data" NS_PUBSUB_SUBSCRIBE_OPTIONS = NS_PUBSUB + "#subscribe_options" -NS_ORDER_BY = u"urn:xmpp:order-by:0" +NS_ORDER_BY = "urn:xmpp:order-by:0" # XPath to match pubsub requests PUBSUB_REQUEST = '/iq[@type="get" or @type="set"]/' + \ @@ -198,7 +198,7 @@ element = domish.Element((defaultUri, 'subscription')) if self.nodeIdentifier: element['node'] = self.nodeIdentifier - element['jid'] = unicode(self.subscriber) + element['jid'] = str(self.subscriber) element['subscription'] = self.state if self.subscriptionIdentifier: element['subid'] = self.subscriptionIdentifier @@ -229,7 +229,7 @@ if id is not None: self['id'] = id if payload is not None: - if isinstance(payload, basestring): + if isinstance(payload, str): self.addRawXml(payload) else: self.addChild(payload) @@ -326,7 +326,7 @@ } # Map request verb to request iq type and subelement name - _verbRequestMap = dict(((v, k) for k, v in _requestVerbMap.iteritems())) + _verbRequestMap = dict(((v, k) for k, v in _requestVerbMap.items())) # Map request verb to parameter handler names _parameters = { @@ -463,7 +463,7 @@ if form.formType in ('submit', 'cancel'): self.options = form else: - raise BadRequest(text=u"Unexpected form type '%s'" % form.formType) + raise BadRequest(text="Unexpected form type '%s'" % form.formType) else: raise BadRequest(text="Missing configuration form") @@ -477,7 +477,7 @@ form = data_form.findForm(element, NS_PUBSUB_NODE_CONFIG) if form is not None: if form.formType != 'submit': - raise BadRequest(text=u"Unexpected form type '%s'" % + raise BadRequest(text="Unexpected form type '%s'" % form.formType) else: form = data_form.Form('submit', @@ -539,7 +539,7 @@ Render maximum items into an items request. """ if self.maxItems: - verbElement['max_items'] = unicode(self.maxItems) + verbElement['max_items'] = str(self.maxItems) def _parse_subidOrNone(self, verbElement): @@ -566,7 +566,7 @@ if form.formType in ('submit', 'cancel'): self.options = form else: - raise BadRequest(text=u"Unexpected form type '%s'" % form.formType) + raise BadRequest(text="Unexpected form type '%s'" % form.formType) else: raise BadRequest(text="Missing options form") @@ -582,7 +582,7 @@ NS_PUBSUB_SUBSCRIBE_OPTIONS) if form is not None: if form.formType != 'submit': - raise BadRequest(text=u"Unexpected form type '%s'" % + raise BadRequest(text="Unexpected form type '%s'" % form.formType) else: form = data_form.Form('submit', @@ -618,7 +618,7 @@ def _render_affiliations(self, verbElement): - for entity, affiliation in self.affiliations.iteritems(): + for entity, affiliation in self.affiliations.items(): affiliationElement = verbElement.addElement((NS_PUBSUB_OWNER, 'affiliation')) affiliationElement['jid'] = entity.full() affiliationElement['affiliation'] = affiliation @@ -815,11 +815,11 @@ +@implementer(IPubSubClient) class PubSubClient(XMPPHandler): """ Publish subscribe client protocol. """ - implements(IPubSubClient) _request_class = PubSubRequest @@ -1181,6 +1181,7 @@ +@implementer(IPubSubService, disco.IDisco) class PubSubService(XMPPHandler, IQHandlerMixin): """ Protocol implementation for a XMPP Publish Subscribe Service. @@ -1209,7 +1210,6 @@ @type pubSubFeatures: C{list} or C{None} """ - implements(IPubSubService, disco.IDisco) iqHandlers = { '/*': '_onPubSubRequest', @@ -1322,7 +1322,7 @@ for node in nodes: if not node: continue - elif isinstance(node, basestring): + elif isinstance(node, str): items.append(disco.DiscoItem(target, node)) else: _node, name = node @@ -1527,7 +1527,7 @@ if request.nodeIdentifier: affiliations['node'] = request.nodeIdentifier - for entity, affiliation in result.iteritems(): + for entity, affiliation in result.items(): item = affiliations.addElement('affiliation') item['jid'] = entity.full() item['affiliation'] = affiliation @@ -1649,9 +1649,9 @@ +@implementer(IPubSubResource) class PubSubResource(object): - implements(IPubSubResource) features = [] discoIdentity = disco.DiscoIdentity('pubsub',
--- a/sat_tmp/wokkel/rsm.py Tue Aug 13 18:58:08 2019 +0200 +++ b/sat_tmp/wokkel/rsm.py Tue Aug 13 18:58:11 2019 +0200 @@ -28,7 +28,7 @@ from twisted.words.xish import domish from twisted.words.protocols.jabber import error -import pubsub +from . import pubsub import copy @@ -76,11 +76,11 @@ if after is not None: assert before is None - assert isinstance(after, basestring) + assert isinstance(after, str) self.after = after if before is not None: - assert isinstance(before, basestring) + assert isinstance(before, str) self.before = before def __str__(self): @@ -101,45 +101,45 @@ set_elt = element else: try: - set_elt = element.elements(NS_RSM, 'set').next() + set_elt = next(element.elements(NS_RSM, 'set')) except StopIteration: raise RSMNotFoundError() try: - before_elt = set_elt.elements(NS_RSM, 'before').next() + before_elt = next(set_elt.elements(NS_RSM, 'before')) except StopIteration: before = None else: - before = unicode(before_elt) + before = str(before_elt) try: - after_elt = set_elt.elements(NS_RSM, 'after').next() + after_elt = next(set_elt.elements(NS_RSM, 'after')) except StopIteration: after = None else: - after = unicode(after_elt) + after = str(after_elt) if not after: raise RSMError("<after/> element can't be empty in RSM request") try: - max_elt = set_elt.elements(NS_RSM, 'max').next() + max_elt = next(set_elt.elements(NS_RSM, 'max')) except StopIteration: # FIXME: even if it doesn't make a lot of sense without it # <max/> element is not mandatory in XEP-0059 raise RSMError("RSM request is missing its 'max' element") else: try: - max_ = int(unicode(max_elt)) + max_ = int(str(max_elt)) except ValueError: raise RSMError("bad value for 'max' element") try: - index_elt = set_elt.elements(NS_RSM, 'index').next() + index_elt = next(set_elt.elements(NS_RSM, 'index')) except StopIteration: index = None else: try: - index = int(unicode(index_elt)) + index = int(str(index_elt)) except ValueError: raise RSMError("bad value for 'index' element") @@ -152,10 +152,10 @@ @rtype: L{domish.Element} """ set_elt = domish.Element((NS_RSM, 'set')) - set_elt.addElement('max', content=unicode(self.max)) + set_elt.addElement('max', content=str(self.max)) if self.index is not None: - set_elt.addElement('index', content=unicode(self.index)) + set_elt.addElement('index', content=str(self.index)) if self.before is not None: if self.before == '': # request the last page @@ -231,17 +231,17 @@ @rtype: L{RSMResponse} """ try: - set_elt = element.elements(NS_RSM, 'set').next() + set_elt = next(element.elements(NS_RSM, 'set')) except StopIteration: raise RSMNotFoundError() try: - first_elt = set_elt.elements(NS_RSM, 'first').next() + first_elt = next(set_elt.elements(NS_RSM, 'first')) except StopIteration: first = None index = None else: - first = unicode(first_elt) + first = str(first_elt) try: index = int(first_elt['index']) except KeyError: @@ -250,7 +250,7 @@ raise RSMError("bad index in RSM response") try: - last_elt = set_elt.elements(NS_RSM, 'last').next() + last_elt = next(set_elt.elements(NS_RSM, 'last')) except StopIteration: if first is not None: raise RSMError("RSM response is missing its 'last' element") @@ -259,15 +259,15 @@ else: if first is None: raise RSMError("RSM response is missing its 'first' element") - last = unicode(last_elt) + last = str(last_elt) try: - count_elt = set_elt.elements(NS_RSM, 'count').next() + count_elt = next(set_elt.elements(NS_RSM, 'count')) except StopIteration: count = None else: try: - count = int(unicode(count_elt)) + count = int(str(count_elt)) except ValueError: raise RSMError("invalid count in RSM response") @@ -283,12 +283,12 @@ if self.first is not None: first_elt = set_elt.addElement('first', content=self.first) if self.index is not None: - first_elt['index'] = unicode(self.index) + first_elt['index'] = str(self.index) set_elt.addElement('last', content=self.last) if self.count is not None: - set_elt.addElement('count', content=unicode(self.count)) + set_elt.addElement('count', content=str(self.count)) return set_elt @@ -315,7 +315,7 @@ for attr in ('first', 'last', 'index', 'count'): value = getattr(self, attr) if value is not None: - result[attr] = unicode(value) + result[attr] = str(value) return result
--- a/sat_tmp/wokkel/test/test_pubsub.py Tue Aug 13 18:58:08 2019 +0200 +++ b/sat_tmp/wokkel/test/test_pubsub.py Tue Aug 13 18:58:11 2019 +0200 @@ -152,10 +152,10 @@ item3['id'] = 'item3' def itemsReceived(event): - self.assertEquals(JID('user@example.org/home'), event.recipient) - self.assertEquals(JID('pubsub.example.org'), event.sender) - self.assertEquals('test', event.nodeIdentifier) - self.assertEquals([item1, item2, item3], event.items) + self.assertEqual(JID('user@example.org/home'), event.recipient) + self.assertEqual(JID('pubsub.example.org'), event.sender) + self.assertEqual('test', event.nodeIdentifier) + self.assertEqual([item1, item2, item3], event.items) d, self.protocol.itemsReceived = calledAsync(itemsReceived) self.stub.send(message) @@ -177,10 +177,10 @@ message.addChild(headers) def itemsReceived(event): - self.assertEquals(JID('user@example.org/home'), event.recipient) - self.assertEquals(JID('pubsub.example.org'), event.sender) - self.assertEquals('test', event.nodeIdentifier) - self.assertEquals({'Collection': ['collection']}, event.headers) + self.assertEqual(JID('user@example.org/home'), event.recipient) + self.assertEqual(JID('pubsub.example.org'), event.sender) + self.assertEqual('test', event.nodeIdentifier) + self.assertEqual({'Collection': ['collection']}, event.headers) d, self.protocol.itemsReceived = calledAsync(itemsReceived) self.stub.send(message) @@ -225,9 +225,9 @@ delete['node'] = 'test' def deleteReceived(event): - self.assertEquals(JID('user@example.org/home'), event.recipient) - self.assertEquals(JID('pubsub.example.org'), event.sender) - self.assertEquals('test', event.nodeIdentifier) + self.assertEqual(JID('user@example.org/home'), event.recipient) + self.assertEqual(JID('pubsub.example.org'), event.sender) + self.assertEqual('test', event.nodeIdentifier) d, self.protocol.deleteReceived = calledAsync(deleteReceived) self.stub.send(message) @@ -248,10 +248,10 @@ delete.addElement('redirect')['uri'] = uri def deleteReceived(event): - self.assertEquals(JID('user@example.org/home'), event.recipient) - self.assertEquals(JID('pubsub.example.org'), event.sender) - self.assertEquals('test', event.nodeIdentifier) - self.assertEquals(uri, event.redirectURI) + self.assertEqual(JID('user@example.org/home'), event.recipient) + self.assertEqual(JID('pubsub.example.org'), event.sender) + self.assertEqual('test', event.nodeIdentifier) + self.assertEqual(uri, event.redirectURI) d, self.protocol.deleteReceived = calledAsync(deleteReceived) self.stub.send(message) @@ -270,9 +270,9 @@ items['node'] = 'test' def purgeReceived(event): - self.assertEquals(JID('user@example.org/home'), event.recipient) - self.assertEquals(JID('pubsub.example.org'), event.sender) - self.assertEquals('test', event.nodeIdentifier) + self.assertEqual(JID('user@example.org/home'), event.recipient) + self.assertEqual(JID('pubsub.example.org'), event.sender) + self.assertEqual('test', event.nodeIdentifier) d, self.protocol.purgeReceived = calledAsync(purgeReceived) self.stub.send(message) @@ -285,21 +285,21 @@ """ def cb(nodeIdentifier): - self.assertEquals('test', nodeIdentifier) + self.assertEqual('test', nodeIdentifier) d = self.protocol.createNode(JID('pubsub.example.org'), 'test') d.addCallback(cb) iq = self.stub.output[-1] - self.assertEquals('pubsub.example.org', iq.getAttribute('to')) - self.assertEquals('set', iq.getAttribute('type')) - self.assertEquals('pubsub', iq.pubsub.name) - self.assertEquals(NS_PUBSUB, iq.pubsub.uri) + self.assertEqual('pubsub.example.org', iq.getAttribute('to')) + self.assertEqual('set', iq.getAttribute('type')) + self.assertEqual('pubsub', iq.pubsub.name) + self.assertEqual(NS_PUBSUB, iq.pubsub.uri) children = list(domish.generateElementsQNamed(iq.pubsub.children, 'create', NS_PUBSUB)) - self.assertEquals(1, len(children)) + self.assertEqual(1, len(children)) child = children[0] - self.assertEquals('test', child['node']) + self.assertEqual('test', child['node']) response = toResponse(iq, 'result') self.stub.send(response) @@ -312,7 +312,7 @@ """ def cb(nodeIdentifier): - self.assertEquals('test', nodeIdentifier) + self.assertEqual('test', nodeIdentifier) d = self.protocol.createNode(JID('pubsub.example.org')) d.addCallback(cb) @@ -337,7 +337,7 @@ """ def cb(nodeIdentifier): - self.assertEquals('test2', nodeIdentifier) + self.assertEqual('test2', nodeIdentifier) d = self.protocol.createNode(JID('pubsub.example.org'), 'test') d.addCallback(cb) @@ -346,7 +346,7 @@ children = list(domish.generateElementsQNamed(iq.pubsub.children, 'create', NS_PUBSUB)) child = children[0] - self.assertEquals('test', child['node']) + self.assertEqual('test', child['node']) response = toResponse(iq, 'result') command = response.addElement((NS_PUBSUB, 'pubsub')) @@ -365,7 +365,7 @@ sender=JID('user@example.org')) iq = self.stub.output[-1] - self.assertEquals('user@example.org', iq['from']) + self.assertEqual('user@example.org', iq['from']) response = toResponse(iq, 'result') self.stub.send(response) @@ -415,15 +415,15 @@ d = self.protocol.deleteNode(JID('pubsub.example.org'), 'test') iq = self.stub.output[-1] - self.assertEquals('pubsub.example.org', iq.getAttribute('to')) - self.assertEquals('set', iq.getAttribute('type')) - self.assertEquals('pubsub', iq.pubsub.name) - self.assertEquals(NS_PUBSUB_OWNER, iq.pubsub.uri) + self.assertEqual('pubsub.example.org', iq.getAttribute('to')) + self.assertEqual('set', iq.getAttribute('type')) + self.assertEqual('pubsub', iq.pubsub.name) + self.assertEqual(NS_PUBSUB_OWNER, iq.pubsub.uri) children = list(domish.generateElementsQNamed(iq.pubsub.children, 'delete', NS_PUBSUB_OWNER)) - self.assertEquals(1, len(children)) + self.assertEqual(1, len(children)) child = children[0] - self.assertEquals('test', child['node']) + self.assertEqual('test', child['node']) response = toResponse(iq, 'result') self.stub.send(response) @@ -439,7 +439,7 @@ sender=JID('user@example.org')) iq = self.stub.output[-1] - self.assertEquals('user@example.org', iq['from']) + self.assertEqual('user@example.org', iq['from']) response = toResponse(iq, 'result') self.stub.send(response) @@ -455,18 +455,18 @@ d = self.protocol.publish(JID('pubsub.example.org'), 'test', [item]) iq = self.stub.output[-1] - self.assertEquals('pubsub.example.org', iq.getAttribute('to')) - self.assertEquals('set', iq.getAttribute('type')) - self.assertEquals('pubsub', iq.pubsub.name) - self.assertEquals(NS_PUBSUB, iq.pubsub.uri) + self.assertEqual('pubsub.example.org', iq.getAttribute('to')) + self.assertEqual('set', iq.getAttribute('type')) + self.assertEqual('pubsub', iq.pubsub.name) + self.assertEqual(NS_PUBSUB, iq.pubsub.uri) children = list(domish.generateElementsQNamed(iq.pubsub.children, 'publish', NS_PUBSUB)) - self.assertEquals(1, len(children)) + self.assertEqual(1, len(children)) child = children[0] - self.assertEquals('test', child['node']) + self.assertEqual('test', child['node']) items = list(domish.generateElementsQNamed(child.children, 'item', NS_PUBSUB)) - self.assertEquals(1, len(items)) + self.assertEqual(1, len(items)) self.assertIdentical(item, items[0]) response = toResponse(iq, 'result') @@ -482,15 +482,15 @@ d = self.protocol.publish(JID('pubsub.example.org'), 'test') iq = self.stub.output[-1] - self.assertEquals('pubsub.example.org', iq.getAttribute('to')) - self.assertEquals('set', iq.getAttribute('type')) - self.assertEquals('pubsub', iq.pubsub.name) - self.assertEquals(NS_PUBSUB, iq.pubsub.uri) + self.assertEqual('pubsub.example.org', iq.getAttribute('to')) + self.assertEqual('set', iq.getAttribute('type')) + self.assertEqual('pubsub', iq.pubsub.name) + self.assertEqual(NS_PUBSUB, iq.pubsub.uri) children = list(domish.generateElementsQNamed(iq.pubsub.children, 'publish', NS_PUBSUB)) - self.assertEquals(1, len(children)) + self.assertEqual(1, len(children)) child = children[0] - self.assertEquals('test', child['node']) + self.assertEqual('test', child['node']) response = toResponse(iq, 'result') self.stub.send(response) @@ -507,7 +507,7 @@ JID('user@example.org')) iq = self.stub.output[-1] - self.assertEquals('user@example.org', iq['from']) + self.assertEqual('user@example.org', iq['from']) response = toResponse(iq, 'result') self.stub.send(response) @@ -522,16 +522,16 @@ JID('user@example.org')) iq = self.stub.output[-1] - self.assertEquals('pubsub.example.org', iq.getAttribute('to')) - self.assertEquals('set', iq.getAttribute('type')) - self.assertEquals('pubsub', iq.pubsub.name) - self.assertEquals(NS_PUBSUB, iq.pubsub.uri) + self.assertEqual('pubsub.example.org', iq.getAttribute('to')) + self.assertEqual('set', iq.getAttribute('type')) + self.assertEqual('pubsub', iq.pubsub.name) + self.assertEqual(NS_PUBSUB, iq.pubsub.uri) children = list(domish.generateElementsQNamed(iq.pubsub.children, 'subscribe', NS_PUBSUB)) - self.assertEquals(1, len(children)) + self.assertEqual(1, len(children)) child = children[0] - self.assertEquals('test', child['node']) - self.assertEquals('user@example.org', child['jid']) + self.assertEqual('test', child['node']) + self.assertEqual('user@example.org', child['jid']) response = toResponse(iq, 'result') pubsub = response.addElement((NS_PUBSUB, 'pubsub')) @@ -648,7 +648,7 @@ sender=JID('user@example.org')) iq = self.stub.output[-1] - self.assertEquals('user@example.org', iq['from']) + self.assertEqual('user@example.org', iq['from']) response = toResponse(iq, 'result') pubsub = response.addElement((NS_PUBSUB, 'pubsub')) @@ -692,16 +692,16 @@ JID('user@example.org')) iq = self.stub.output[-1] - self.assertEquals('pubsub.example.org', iq.getAttribute('to')) - self.assertEquals('set', iq.getAttribute('type')) - self.assertEquals('pubsub', iq.pubsub.name) - self.assertEquals(NS_PUBSUB, iq.pubsub.uri) + self.assertEqual('pubsub.example.org', iq.getAttribute('to')) + self.assertEqual('set', iq.getAttribute('type')) + self.assertEqual('pubsub', iq.pubsub.name) + self.assertEqual(NS_PUBSUB, iq.pubsub.uri) children = list(domish.generateElementsQNamed(iq.pubsub.children, 'unsubscribe', NS_PUBSUB)) - self.assertEquals(1, len(children)) + self.assertEqual(1, len(children)) child = children[0] - self.assertEquals('test', child['node']) - self.assertEquals('user@example.org', child['jid']) + self.assertEqual('test', child['node']) + self.assertEqual('user@example.org', child['jid']) self.stub.send(toResponse(iq, 'result')) return d @@ -716,7 +716,7 @@ sender=JID('user@example.org')) iq = self.stub.output[-1] - self.assertEquals('user@example.org', iq['from']) + self.assertEqual('user@example.org', iq['from']) self.stub.send(toResponse(iq, 'result')) return d @@ -731,7 +731,7 @@ iq = self.stub.output[-1] child = iq.pubsub.unsubscribe - self.assertEquals('1234', child['subid']) + self.assertEqual('1234', child['subid']) self.stub.send(toResponse(iq, 'result')) return d @@ -742,21 +742,21 @@ Test sending items request. """ def cb(items): - self.assertEquals([], items) + self.assertEqual([], items) d = self.protocol.items(JID('pubsub.example.org'), 'test') d.addCallback(cb) iq = self.stub.output[-1] - self.assertEquals('pubsub.example.org', iq.getAttribute('to')) - self.assertEquals('get', iq.getAttribute('type')) - self.assertEquals('pubsub', iq.pubsub.name) - self.assertEquals(NS_PUBSUB, iq.pubsub.uri) + self.assertEqual('pubsub.example.org', iq.getAttribute('to')) + self.assertEqual('get', iq.getAttribute('type')) + self.assertEqual('pubsub', iq.pubsub.name) + self.assertEqual(NS_PUBSUB, iq.pubsub.uri) children = list(domish.generateElementsQNamed(iq.pubsub.children, 'items', NS_PUBSUB)) - self.assertEquals(1, len(children)) + self.assertEqual(1, len(children)) child = children[0] - self.assertEquals('test', child['node']) + self.assertEqual('test', child['node']) response = toResponse(iq, 'result') items = response.addElement((NS_PUBSUB, 'pubsub')).addElement('items') @@ -772,23 +772,23 @@ Test sending items request, with limit on the number of items. """ def cb(items): - self.assertEquals(2, len(items)) - self.assertEquals([item1, item2], items) + self.assertEqual(2, len(items)) + self.assertEqual([item1, item2], items) d = self.protocol.items(JID('pubsub.example.org'), 'test', maxItems=2) d.addCallback(cb) iq = self.stub.output[-1] - self.assertEquals('pubsub.example.org', iq.getAttribute('to')) - self.assertEquals('get', iq.getAttribute('type')) - self.assertEquals('pubsub', iq.pubsub.name) - self.assertEquals(NS_PUBSUB, iq.pubsub.uri) + self.assertEqual('pubsub.example.org', iq.getAttribute('to')) + self.assertEqual('get', iq.getAttribute('type')) + self.assertEqual('pubsub', iq.pubsub.name) + self.assertEqual(NS_PUBSUB, iq.pubsub.uri) children = list(domish.generateElementsQNamed(iq.pubsub.children, 'items', NS_PUBSUB)) - self.assertEquals(1, len(children)) + self.assertEqual(1, len(children)) child = children[0] - self.assertEquals('test', child['node']) - self.assertEquals('2', child['max_items']) + self.assertEqual('test', child['node']) + self.assertEqual('2', child['max_items']) response = toResponse(iq, 'result') items = response.addElement((NS_PUBSUB, 'pubsub')).addElement('items') @@ -808,27 +808,27 @@ Test sending items request with item identifiers. """ def cb(items): - self.assertEquals(2, len(items)) - self.assertEquals([item1, item2], items) + self.assertEqual(2, len(items)) + self.assertEqual([item1, item2], items) d = self.protocol.items(JID('pubsub.example.org'), 'test', itemIdentifiers=['item1', 'item2']) d.addCallback(cb) iq = self.stub.output[-1] - self.assertEquals('pubsub.example.org', iq.getAttribute('to')) - self.assertEquals('get', iq.getAttribute('type')) - self.assertEquals('pubsub', iq.pubsub.name) - self.assertEquals(NS_PUBSUB, iq.pubsub.uri) + self.assertEqual('pubsub.example.org', iq.getAttribute('to')) + self.assertEqual('get', iq.getAttribute('type')) + self.assertEqual('pubsub', iq.pubsub.name) + self.assertEqual(NS_PUBSUB, iq.pubsub.uri) children = list(domish.generateElementsQNamed(iq.pubsub.children, 'items', NS_PUBSUB)) - self.assertEquals(1, len(children)) + self.assertEqual(1, len(children)) child = children[0] - self.assertEquals('test', child['node']) + self.assertEqual('test', child['node']) itemIdentifiers = [item.getAttribute('id') for item in domish.generateElementsQNamed(child.children, 'item', NS_PUBSUB)] - self.assertEquals(['item1', 'item2'], itemIdentifiers) + self.assertEqual(['item1', 'item2'], itemIdentifiers) response = toResponse(iq, 'result') items = response.addElement((NS_PUBSUB, 'pubsub')).addElement('items') @@ -853,7 +853,7 @@ iq = self.stub.output[-1] child = iq.pubsub.items - self.assertEquals('1234', child['subid']) + self.assertEqual('1234', child['subid']) response = toResponse(iq, 'result') items = response.addElement((NS_PUBSUB, 'pubsub')).addElement('items') @@ -872,7 +872,7 @@ sender=JID('user@example.org')) iq = self.stub.output[-1] - self.assertEquals('user@example.org', iq['from']) + self.assertEqual('user@example.org', iq['from']) response = toResponse(iq, 'result') items = response.addElement((NS_PUBSUB, 'pubsub')).addElement('items') @@ -890,19 +890,19 @@ itemIdentifiers=['item1', 'item2']) iq = self.stub.output[-1] - self.assertEquals('pubsub.example.org', iq.getAttribute('to')) - self.assertEquals('set', iq.getAttribute('type')) - self.assertEquals('pubsub', iq.pubsub.name) - self.assertEquals(NS_PUBSUB, iq.pubsub.uri) + self.assertEqual('pubsub.example.org', iq.getAttribute('to')) + self.assertEqual('set', iq.getAttribute('type')) + self.assertEqual('pubsub', iq.pubsub.name) + self.assertEqual(NS_PUBSUB, iq.pubsub.uri) children = list(domish.generateElementsQNamed(iq.pubsub.children, 'retract', NS_PUBSUB)) - self.assertEquals(1, len(children)) + self.assertEqual(1, len(children)) child = children[0] - self.assertEquals('test', child['node']) + self.assertEqual('test', child['node']) itemIdentifiers = [item.getAttribute('id') for item in domish.generateElementsQNamed(child.children, 'item', NS_PUBSUB)] - self.assertEquals(['item1', 'item2'], itemIdentifiers) + self.assertEqual(['item1', 'item2'], itemIdentifiers) self.stub.send(toResponse(iq, 'result')) return d @@ -917,7 +917,7 @@ sender=JID('user@example.org')) iq = self.stub.output[-1] - self.assertEquals('user@example.org', iq['from']) + self.assertEqual('user@example.org', iq['from']) self.stub.send(toResponse(iq, 'result')) return d @@ -1131,8 +1131,8 @@ request = pubsub.PubSubRequest.fromElement(parseXml(xml)) self.assertEqual(2, len(request.items)) - self.assertEqual(u'item1', request.items[0]["id"]) - self.assertEqual(u'item2', request.items[1]["id"]) + self.assertEqual('item1', request.items[0]["id"]) + self.assertEqual('item2', request.items[1]["id"]) def test_fromElementPublishItemsOptions(self): @@ -1158,8 +1158,8 @@ request = pubsub.PubSubRequest.fromElement(parseXml(xml)) self.assertEqual(2, len(request.items)) - self.assertEqual(u'item1', request.items[0]["id"]) - self.assertEqual(u'item2', request.items[1]["id"]) + self.assertEqual('item1', request.items[0]["id"]) + self.assertEqual('item2', request.items[1]["id"]) def test_fromElementPublishNoNode(self): """ @@ -1650,7 +1650,7 @@ request = pubsub.PubSubRequest.fromElement(parseXml(xml)) self.assertEqual({}, request.options.getValues()) - self.assertEqual(u'mynode', request.nodeIdentifier) + self.assertEqual('mynode', request.nodeIdentifier) def test_fromElementCreateConfigureEmptyWrongOrder(self): @@ -1673,7 +1673,7 @@ request = pubsub.PubSubRequest.fromElement(parseXml(xml)) self.assertEqual({}, request.options.getValues()) - self.assertEqual(u'mynode', request.nodeIdentifier) + self.assertEqual('mynode', request.nodeIdentifier) def test_fromElementCreateConfigure(self): @@ -1702,9 +1702,9 @@ request = pubsub.PubSubRequest.fromElement(parseXml(xml)) values = request.options self.assertIn('pubsub#access_model', values) - self.assertEqual(u'open', values['pubsub#access_model']) + self.assertEqual('open', values['pubsub#access_model']) self.assertIn('pubsub#persist_items', values) - self.assertEqual(u'0', values['pubsub#persist_items']) + self.assertEqual('0', values['pubsub#persist_items']) def test_fromElementCreateConfigureBadFormType(self): @@ -1756,10 +1756,10 @@ """ request = pubsub.PubSubRequest.fromElement(parseXml(xml)) - self.assertEquals(u'default', request.verb) - self.assertEquals(JID('user@example.org'), request.sender) - self.assertEquals(JID('pubsub.example.org'), request.recipient) - self.assertEquals(u'leaf', request.nodeType) + self.assertEqual('default', request.verb) + self.assertEqual(JID('user@example.org'), request.sender) + self.assertEqual(JID('pubsub.example.org'), request.recipient) + self.assertEqual('leaf', request.nodeType) def test_fromElementDefaultCollection(self): @@ -1787,7 +1787,7 @@ """ request = pubsub.PubSubRequest.fromElement(parseXml(xml)) - self.assertEquals('collection', request.nodeType) + self.assertEqual('collection', request.nodeType) def test_fromElementConfigureGet(self): @@ -2157,7 +2157,7 @@ If getInfo returns invalid response, it should be logged, then ignored. """ def cb(info): - self.assertEquals([], info) + self.assertEqual([], info) self.assertEqual(1, len(self.flushLoggedErrors(TypeError))) def getInfo(requestor, target, nodeIdentifier): @@ -2175,7 +2175,7 @@ If getInfo returns invalid response, it should be logged, then ignored. """ def cb(info): - self.assertEquals([], info) + self.assertEqual([], info) self.assertEqual(1, len(self.flushLoggedErrors(NotImplementedError))) def getInfo(requestor, target, nodeIdentifier): @@ -2438,9 +2438,9 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) d = self.handleRequest(xml) self.assertFailure(d, error.StanzaError) @@ -2470,9 +2470,9 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) d = self.handleRequest(xml) self.assertFailure(d, error.StanzaError) @@ -2633,13 +2633,13 @@ """ def create(request): - return defer.succeed(u'myrenamednode') + return defer.succeed('myrenamednode') def cb(element): self.assertEqual('pubsub', element.name) self.assertEqual(NS_PUBSUB, element.uri) self.assertEqual(NS_PUBSUB, element.create.uri) - self.assertEqual(u'myrenamednode', + self.assertEqual('myrenamednode', element.create.getAttribute('node')) self.resource.create = create @@ -2664,13 +2664,13 @@ """ def create(request): - return defer.succeed(u'random') + return defer.succeed('random') def cb(element): self.assertEqual('pubsub', element.name) self.assertEqual(NS_PUBSUB, element.uri) self.assertEqual(NS_PUBSUB, element.create.uri) - self.assertEqual(u'random', element.create.getAttribute('node')) + self.assertEqual('random', element.create.getAttribute('node')) self.resource.create = create verify.verifyObject(iwokkel.IPubSubResource, self.resource) @@ -2755,11 +2755,11 @@ 'x-myfield': '1'}) def cb(element): - self.assertEquals('pubsub', element.name) - self.assertEquals(NS_PUBSUB_OWNER, element.uri) - self.assertEquals(NS_PUBSUB_OWNER, element.default.uri) + self.assertEqual('pubsub', element.name) + self.assertEqual(NS_PUBSUB_OWNER, element.uri) + self.assertEqual(NS_PUBSUB_OWNER, element.default.uri) form = data_form.Form.fromElement(element.default.x) - self.assertEquals(NS_PUBSUB_NODE_CONFIG, form.formNamespace) + self.assertEqual(NS_PUBSUB_NODE_CONFIG, form.formNamespace) form.typeCheck(fieldDefs) self.assertIn('pubsub#persist_items', form.fields) self.assertFalse(form.fields['pubsub#persist_items'].value) @@ -2806,7 +2806,7 @@ self.fail("Unexpected call to default") def cb(result): - self.assertEquals('not-acceptable', result.condition) + self.assertEqual('not-acceptable', result.condition) self.resource.getConfigurationOptions = getConfigurationOptions self.resource.default = default @@ -2995,8 +2995,8 @@ } def configureSet(request): - self.assertEquals(['pubsub#deliver_payloads'], - request.options.keys()) + self.assertEqual(['pubsub#deliver_payloads'], + list(request.options.keys())) self.resource.getConfigurationOptions = getConfigurationOptions self.resource.configureSet = configureSet @@ -3027,7 +3027,7 @@ """ def cb(result): - self.assertEquals('bad-request', result.condition) + self.assertEqual('bad-request', result.condition) self.assertEqual("Unexpected form type 'result'", result.text) d = self.handleRequest(xml) @@ -3153,20 +3153,20 @@ notifications) message = self.stub.output[-1] - self.assertEquals('message', message.name) + self.assertEqual('message', message.name) self.assertIdentical(None, message.uri) - self.assertEquals('user@example.org', message['to']) - self.assertEquals('pubsub.example.org', message['from']) + self.assertEqual('user@example.org', message['to']) + self.assertEqual('pubsub.example.org', message['from']) self.assertTrue(message.event) - self.assertEquals(NS_PUBSUB_EVENT, message.event.uri) + self.assertEqual(NS_PUBSUB_EVENT, message.event.uri) self.assertTrue(message.event.items) - self.assertEquals(NS_PUBSUB_EVENT, message.event.items.uri) + self.assertEqual(NS_PUBSUB_EVENT, message.event.items.uri) self.assertTrue(message.event.items.hasAttribute('node')) - self.assertEquals('test', message.event.items['node']) + self.assertEqual('test', message.event.items['node']) itemElements = list(domish.generateElementsQNamed( message.event.items.children, 'item', NS_PUBSUB_EVENT)) - self.assertEquals(1, len(itemElements)) - self.assertEquals('current', itemElements[0].getAttribute('id')) + self.assertEqual(1, len(itemElements)) + self.assertEqual('current', itemElements[0].getAttribute('id')) def test_notifyPublishCollection(self): @@ -3185,7 +3185,7 @@ message = self.stub.output[-1] self.assertTrue(message.event.items.hasAttribute('node')) - self.assertEquals('test', message.event.items['node']) + self.assertEqual('test', message.event.items['node']) headers = shim.extractHeaders(message) self.assertIn('Collection', headers) self.assertIn('', headers['Collection']) @@ -3200,10 +3200,10 @@ subscriptions) message = self.stub.output[-1] - self.assertEquals('message', message.name) + self.assertEqual('message', message.name) self.assertIdentical(None, message.uri) - self.assertEquals('user@example.org', message['to']) - self.assertEquals('pubsub.example.org', message['from']) + self.assertEqual('user@example.org', message['to']) + self.assertEqual('pubsub.example.org', message['from']) self.assertTrue(message.event) self.assertEqual(NS_PUBSUB_EVENT, message.event.uri) self.assertTrue(message.event.delete) @@ -3222,10 +3222,10 @@ subscriptions, redirectURI) message = self.stub.output[-1] - self.assertEquals('message', message.name) + self.assertEqual('message', message.name) self.assertIdentical(None, message.uri) - self.assertEquals('user@example.org', message['to']) - self.assertEquals('pubsub.example.org', message['from']) + self.assertEqual('user@example.org', message['to']) + self.assertEqual('pubsub.example.org', message['from']) self.assertTrue(message.event) self.assertEqual(NS_PUBSUB_EVENT, message.event.uri) self.assertTrue(message.event.delete) @@ -3253,10 +3253,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('manage-subscriptions', + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('manage-subscriptions', result.appCondition['feature']) d = self.handleRequest(xml) @@ -3280,10 +3280,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('manage-subscriptions', + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('manage-subscriptions', result.appCondition['feature']) d = self.handleRequest(xml) @@ -3307,21 +3307,21 @@ """ def affiliationsGet(request): - self.assertEquals('test', request.nodeIdentifier) + self.assertEqual('test', request.nodeIdentifier) return defer.succeed({JID('user@example.org'): 'owner'}) def cb(element): - self.assertEquals(u'pubsub', element.name) - self.assertEquals(NS_PUBSUB_OWNER, element.uri) - self.assertEquals(NS_PUBSUB_OWNER, element.affiliations.uri) - self.assertEquals(u'test', element.affiliations[u'node']) + self.assertEqual('pubsub', element.name) + self.assertEqual(NS_PUBSUB_OWNER, element.uri) + self.assertEqual(NS_PUBSUB_OWNER, element.affiliations.uri) + self.assertEqual('test', element.affiliations['node']) children = list(element.affiliations.elements()) - self.assertEquals(1, len(children)) + self.assertEqual(1, len(children)) affiliation = children[0] - self.assertEquals(u'affiliation', affiliation.name) - self.assertEquals(NS_PUBSUB_OWNER, affiliation.uri) - self.assertEquals(u'user@example.org', affiliation[u'jid']) - self.assertEquals(u'owner', affiliation[u'affiliation']) + self.assertEqual('affiliation', affiliation.name) + self.assertEqual(NS_PUBSUB_OWNER, affiliation.uri) + self.assertEqual('user@example.org', affiliation['jid']) + self.assertEqual('owner', affiliation['affiliation']) self.resource.affiliationsGet = affiliationsGet verify.verifyObject(iwokkel.IPubSubResource, self.resource) @@ -3349,7 +3349,7 @@ return defer.succeed({}) def cb(element): - self.assertFalse(element.affiliations.hasAttribute(u'node')) + self.assertFalse(element.affiliations.hasAttribute('node')) self.resource.affiliationsGet = affiliationsGet verify.verifyObject(iwokkel.IPubSubResource, self.resource) @@ -3375,10 +3375,10 @@ """ def affiliationsSet(request): - self.assertEquals(u'test', request.nodeIdentifier) - otherJID = JID(u'other@example.org') + self.assertEqual('test', request.nodeIdentifier) + otherJID = JID('other@example.org') self.assertIn(otherJID, request.affiliations) - self.assertEquals(u'publisher', request.affiliations[otherJID]) + self.assertEqual('publisher', request.affiliations[otherJID]) self.resource.affiliationsSet = affiliationsSet return self.handleRequest(xml) @@ -3402,7 +3402,7 @@ """ def affiliationsSet(request): - otherJID = JID(u'other@example.org') + otherJID = JID('other@example.org') self.assertIn(otherJID, request.affiliations) self.resource.affiliationsSet = affiliationsSet @@ -3427,7 +3427,7 @@ """ def cb(result): - self.assertEquals('bad-request', result.condition) + self.assertEqual('bad-request', result.condition) d = self.handleRequest(xml) self.assertFailure(d, error.StanzaError) @@ -3452,7 +3452,7 @@ """ def cb(result): - self.assertEquals('bad-request', result.condition) + self.assertEqual('bad-request', result.condition) d = self.handleRequest(xml) self.assertFailure(d, error.StanzaError) @@ -3477,7 +3477,7 @@ """ def cb(result): - self.assertEquals('bad-request', result.condition) + self.assertEqual('bad-request', result.condition) d = self.handleRequest(xml) self.assertFailure(d, error.StanzaError) @@ -3526,10 +3526,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('publish', result.appCondition['feature']) + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('publish', result.appCondition['feature']) d = self.handleRequest(xml) self.assertFailure(d, error.StanzaError) @@ -3552,10 +3552,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('subscribe', result.appCondition['feature']) + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('subscribe', result.appCondition['feature']) d = self.handleRequest(xml) self.assertFailure(d, error.StanzaError) @@ -3578,10 +3578,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('subscribe', result.appCondition['feature']) + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('subscribe', result.appCondition['feature']) d = self.handleRequest(xml) self.assertFailure(d, error.StanzaError) @@ -3604,10 +3604,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('retrieve-subscriptions', + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('retrieve-subscriptions', result.appCondition['feature']) d = self.handleRequest(xml) @@ -3631,10 +3631,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('retrieve-affiliations', + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('retrieve-affiliations', result.appCondition['feature']) d = self.handleRequest(xml) @@ -3658,10 +3658,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('create-nodes', result.appCondition['feature']) + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('create-nodes', result.appCondition['feature']) d = self.handleRequest(xml) self.assertFailure(d, error.StanzaError) @@ -3685,10 +3685,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('retrieve-default', result.appCondition['feature']) + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('retrieve-default', result.appCondition['feature']) d = self.handleRequest(xml) self.assertFailure(d, error.StanzaError) @@ -3712,10 +3712,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('config-node', result.appCondition['feature']) + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('config-node', result.appCondition['feature']) d = self.handleRequest(xml) self.assertFailure(d, error.StanzaError) @@ -3747,10 +3747,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('config-node', result.appCondition['feature']) + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('config-node', result.appCondition['feature']) d = self.handleRequest(xml) self.assertFailure(d, error.StanzaError) @@ -3815,10 +3815,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('retrieve-items', result.appCondition['feature']) + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('retrieve-items', result.appCondition['feature']) d = self.handleRequest(xml) self.assertFailure(d, error.StanzaError) @@ -3843,10 +3843,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('retract-items', result.appCondition['feature']) + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('retract-items', result.appCondition['feature']) d = self.handleRequest(xml) self.assertFailure(d, error.StanzaError) @@ -3868,10 +3868,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('purge-nodes', result.appCondition['feature']) + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('purge-nodes', result.appCondition['feature']) d = self.handleRequest(xml) self.assertFailure(d, error.StanzaError) @@ -3893,10 +3893,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('delete-nodes', result.appCondition['feature']) + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('delete-nodes', result.appCondition['feature']) d = self.handleRequest(xml) self.assertFailure(d, error.StanzaError) @@ -3918,9 +3918,9 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) d = self.handleRequest(xml) self.assertFailure(d, error.StanzaError) @@ -3947,7 +3947,7 @@ Default getNodes returns an empty list. """ def cb(nodes): - self.assertEquals([], nodes) + self.assertEqual([], nodes) d = self.resource.getNodes(JID('user@example.org/home'), JID('pubsub.example.org'), @@ -3963,10 +3963,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('publish', result.appCondition['feature']) + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('publish', result.appCondition['feature']) d = self.resource.publish(pubsub.PubSubRequest()) self.assertFailure(d, error.StanzaError) @@ -3980,10 +3980,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('subscribe', result.appCondition['feature']) + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('subscribe', result.appCondition['feature']) d = self.resource.subscribe(pubsub.PubSubRequest()) self.assertFailure(d, error.StanzaError) @@ -3997,10 +3997,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('subscribe', result.appCondition['feature']) + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('subscribe', result.appCondition['feature']) d = self.resource.unsubscribe(pubsub.PubSubRequest()) self.assertFailure(d, error.StanzaError) @@ -4014,10 +4014,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('retrieve-subscriptions', + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('retrieve-subscriptions', result.appCondition['feature']) d = self.resource.subscriptions(pubsub.PubSubRequest()) @@ -4032,10 +4032,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('retrieve-affiliations', + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('retrieve-affiliations', result.appCondition['feature']) d = self.resource.affiliations(pubsub.PubSubRequest()) @@ -4050,10 +4050,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('create-nodes', result.appCondition['feature']) + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('create-nodes', result.appCondition['feature']) d = self.resource.create(pubsub.PubSubRequest()) self.assertFailure(d, error.StanzaError) @@ -4067,10 +4067,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('retrieve-default', + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('retrieve-default', result.appCondition['feature']) d = self.resource.default(pubsub.PubSubRequest()) @@ -4086,10 +4086,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('config-node', result.appCondition['feature']) + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('config-node', result.appCondition['feature']) d = self.resource.configureGet(pubsub.PubSubRequest()) self.assertFailure(d, error.StanzaError) @@ -4103,10 +4103,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('config-node', result.appCondition['feature']) + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('config-node', result.appCondition['feature']) d = self.resource.configureSet(pubsub.PubSubRequest()) self.assertFailure(d, error.StanzaError) @@ -4120,10 +4120,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('retrieve-items', result.appCondition['feature']) + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('retrieve-items', result.appCondition['feature']) d = self.resource.items(pubsub.PubSubRequest()) self.assertFailure(d, error.StanzaError) @@ -4137,10 +4137,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('retract-items', result.appCondition['feature']) + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('retract-items', result.appCondition['feature']) d = self.resource.retract(pubsub.PubSubRequest()) self.assertFailure(d, error.StanzaError) @@ -4154,10 +4154,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('purge-nodes', result.appCondition['feature']) + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('purge-nodes', result.appCondition['feature']) d = self.resource.purge(pubsub.PubSubRequest()) self.assertFailure(d, error.StanzaError) @@ -4171,10 +4171,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('delete-nodes', result.appCondition['feature']) + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('delete-nodes', result.appCondition['feature']) d = self.resource.delete(pubsub.PubSubRequest()) self.assertFailure(d, error.StanzaError) @@ -4188,10 +4188,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('modify-affiliations', + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('modify-affiliations', result.appCondition['feature']) d = self.resource.affiliationsGet(pubsub.PubSubRequest()) @@ -4206,10 +4206,10 @@ """ def cb(result): - self.assertEquals('feature-not-implemented', result.condition) - self.assertEquals('unsupported', result.appCondition.name) - self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri) - self.assertEquals('modify-affiliations', + self.assertEqual('feature-not-implemented', result.condition) + self.assertEqual('unsupported', result.appCondition.name) + self.assertEqual(NS_PUBSUB_ERRORS, result.appCondition.uri) + self.assertEqual('modify-affiliations', result.appCondition['feature']) d = self.resource.affiliationsSet(pubsub.PubSubRequest())
--- a/sat_tmp/wokkel/test/test_rsm.py Tue Aug 13 18:58:08 2019 +0200 +++ b/sat_tmp/wokkel/test/test_rsm.py Tue Aug 13 18:58:11 2019 +0200 @@ -36,11 +36,11 @@ """ Fail to initialize a RSMRequest with wrong attribute values. """ - self.assertRaises(AssertionError, RSMRequest, index=371, after=u'test') - self.assertRaises(AssertionError, RSMRequest, index=371, before=u'test') + self.assertRaises(AssertionError, RSMRequest, index=371, after='test') + self.assertRaises(AssertionError, RSMRequest, index=371, before='test') self.assertRaises(AssertionError, RSMRequest, before=117) self.assertRaises(AssertionError, RSMRequest, after=312) - self.assertRaises(AssertionError, RSMRequest, after=u'117', before=u'312') + self.assertRaises(AssertionError, RSMRequest, after='117', before='312') def test_parse(self): """ @@ -76,7 +76,7 @@ request = RSMRequest.fromElement(parseXml(xml)) self.assertEqual(3, request.max) self.assertIdentical(None, request.index) - self.assertEqual(u'peterpan@neverland.lit', request.after) + self.assertEqual('peterpan@neverland.lit', request.after) self.assertIdentical(None, request.before) def test_parsePreviousPage(self): @@ -96,7 +96,7 @@ self.assertEqual(5, request.max) self.assertIdentical(None, request.index) self.assertIdentical(None, request.after) - self.assertEqual(u'peterpan@pixyland.org', request.before) + self.assertEqual('peterpan@pixyland.org', request.before) def test_parseLastPage(self): """ @@ -159,13 +159,13 @@ Embed a page request in the element. """ element = domish.Element(('jabber:iq:search', 'query')) - element.addElement('items')['max_items'] = u'10' + element.addElement('items')['max_items'] = '10' RSMRequest(1).render(element) - self.assertEqual(u'10', element.items['max_items']) # not changed + self.assertEqual('10', element.items['max_items']) # not changed self.assertEqual(NS_RSM, element.set.uri) - self.assertEqual(u'1', ''.join(element.set.max.children)) + self.assertEqual('1', ''.join(element.set.max.children)) self.assertIdentical(None, element.set.after) self.assertIdentical(None, element.set.before) self.assertIdentical(None, element.set.index) @@ -175,13 +175,13 @@ Embed a page request in the pubsub element. """ element = domish.Element((pubsub.NS_PUBSUB, 'pubsub')) - element.addElement('items')['max_items'] = u'10' + element.addElement('items')['max_items'] = '10' RSMRequest(3).render(element) - self.assertEqual(u'10', element.items['max_items']) # not changed + self.assertEqual('10', element.items['max_items']) # not changed self.assertEqual(NS_RSM, element.set.uri) - self.assertEqual(u'3', ''.join(element.set.max.children)) + self.assertEqual('3', ''.join(element.set.max.children)) self.assertIdentical(None, element.set.after) self.assertIdentical(None, element.set.before) self.assertIdentical(None, element.set.index) @@ -193,20 +193,20 @@ element = domish.Element(('jabber:iq:search', 'query')) RSMRequest(5, index=127).render(element) self.assertEqual(NS_RSM, element.set.uri) - self.assertEqual(u'5', ''.join(element.set.max.children)) + self.assertEqual('5', ''.join(element.set.max.children)) self.assertIdentical(None, element.set.after) self.assertIdentical(None, element.set.before) - self.assertEqual(u'127', ''.join(element.set.index.children)) + self.assertEqual('127', ''.join(element.set.index.children)) def test_renderAfter(self): """ Embed a page request in the element, specify after. """ element = domish.Element(('jabber:iq:search', 'query')) - RSMRequest(5, after=u'test').render(element) + RSMRequest(5, after='test').render(element) self.assertEqual(NS_RSM, element.set.uri) - self.assertEqual(u'5', ''.join(element.set.max.children)) - self.assertEqual(u'test', ''.join(element.set.after.children)) + self.assertEqual('5', ''.join(element.set.max.children)) + self.assertEqual('test', ''.join(element.set.after.children)) self.assertIdentical(None, element.set.before) self.assertIdentical(None, element.set.index) @@ -215,11 +215,11 @@ Embed a page request in the element, specify before. """ element = domish.Element(('jabber:iq:search', 'query')) - RSMRequest(5, before=u'test').render(element) + RSMRequest(5, before='test').render(element) self.assertEqual(NS_RSM, element.set.uri) - self.assertEqual(u'5', ''.join(element.set.max.children)) + self.assertEqual('5', ''.join(element.set.max.children)) self.assertIdentical(None, element.set.after) - self.assertEqual(u'test', ''.join(element.set.before.children)) + self.assertEqual('test', ''.join(element.set.before.children)) self.assertIdentical(None, element.set.index) @@ -232,8 +232,8 @@ """ Fail to initialize a RSMResponse with wrong attribute values. """ - self.assertRaises(AssertionError, RSMResponse, index=127, first=u'127') - self.assertRaises(AssertionError, RSMResponse, index=127, last=u'351') + self.assertRaises(AssertionError, RSMResponse, index=127, first='127') + self.assertRaises(AssertionError, RSMResponse, index=127, last='351') def test_parse(self): """ @@ -251,8 +251,8 @@ response = RSMResponse.fromElement(parseXml(xml)) self.assertEqual(800, response.count) self.assertEqual(20, response.index) - self.assertEqual(u'stpeter@jabber.org', response.first) - self.assertEqual(u'peterpan@neverland.lit', response.last) + self.assertEqual('stpeter@jabber.org', response.first) + self.assertEqual('peterpan@neverland.lit', response.last) def test_parseEmptySet(self): """ @@ -276,15 +276,15 @@ Embed a page response in the element. """ element = domish.Element(('jabber:iq:search', 'query')) - RSMResponse(u'stpeter@jabber.org', u'peterpan@neverland.lit', 20, 800).render(element) + RSMResponse('stpeter@jabber.org', 'peterpan@neverland.lit', 20, 800).render(element) self.assertEqual(NS_RSM, element.set.uri) - self.assertEqual(u'800', ''.join(element.set.count.children)) - self.assertEqual(u'stpeter@jabber.org', + self.assertEqual('800', ''.join(element.set.count.children)) + self.assertEqual('stpeter@jabber.org', ''.join(element.set.first.children)) - self.assertEqual(u'peterpan@neverland.lit', + self.assertEqual('peterpan@neverland.lit', ''.join(element.set.last.children)) - self.assertEqual(u'20', element.set.first['index']) + self.assertEqual('20', element.set.first['index']) def test_renderEmptySet(self): """ @@ -294,7 +294,7 @@ RSMResponse(count=800).render(element) self.assertEqual(NS_RSM, element.set.uri) - self.assertEqual(u'800', ''.join(element.set.count.children)) + self.assertEqual('800', ''.join(element.set.count.children)) self.assertIdentical(None, element.set.first) self.assertIdentical(None, element.set.last) @@ -317,30 +317,30 @@ """ def cb(response): items, rsm = response - self.assertEquals(2, len(items)) - self.assertEquals([item1, item2], items) - self.assertEquals(rsm, RSMResponse('item1', 'item2', 0, 800)) + self.assertEqual(2, len(items)) + self.assertEqual([item1, item2], items) + self.assertEqual(rsm, RSMResponse('item1', 'item2', 0, 800)) d = self.protocol.items(JID('pubsub.example.org'), 'test', rsm_request=RSMRequest(2)) d.addCallback(cb) iq = self.stub.output[-1] - self.assertEquals('pubsub.example.org', iq.getAttribute('to')) - self.assertEquals('get', iq.getAttribute('type')) - self.assertEquals('pubsub', iq.pubsub.name) - self.assertEquals(pubsub.NS_PUBSUB, iq.pubsub.uri) + self.assertEqual('pubsub.example.org', iq.getAttribute('to')) + self.assertEqual('get', iq.getAttribute('type')) + self.assertEqual('pubsub', iq.pubsub.name) + self.assertEqual(pubsub.NS_PUBSUB, iq.pubsub.uri) children = list(domish.generateElementsQNamed(iq.pubsub.children, 'items', pubsub.NS_PUBSUB)) - self.assertEquals(1, len(children)) + self.assertEqual(1, len(children)) child = children[0] - self.assertEquals('test', child['node']) + self.assertEqual('test', child['node']) set_elts = list(domish.generateElementsQNamed(iq.pubsub.children, 'set', NS_RSM)) - self.assertEquals(1, len(set_elts)) + self.assertEqual(1, len(set_elts)) set_elt = set_elts[0] - self.assertEquals(u'2', ''.join(set_elt.max.children)) + self.assertEqual('2', ''.join(set_elt.max.children)) response = toResponse(iq, 'result') items = response.addElement((pubsub.NS_PUBSUB, @@ -350,7 +350,7 @@ item1['id'] = 'item1' item2 = items.addElement('item') item2['id'] = 'item2' - RSMResponse(u'item1', u'item2', 0, 800).render(response.pubsub) + RSMResponse('item1', 'item2', 0, 800).render(response.pubsub) self.stub.send(response) return d @@ -361,31 +361,31 @@ """ def cb(response): items, rsm = response - self.assertEquals(2, len(items)) - self.assertEquals([item1, item2], items) - self.assertEquals(rsm, RSMResponse('item3', 'item4', 2, 800)) + self.assertEqual(2, len(items)) + self.assertEqual([item1, item2], items) + self.assertEqual(rsm, RSMResponse('item3', 'item4', 2, 800)) d = self.protocol.items(JID('pubsub.example.org'), 'test', - rsm_request=RSMRequest(2, after=u'item2')) + rsm_request=RSMRequest(2, after='item2')) d.addCallback(cb) iq = self.stub.output[-1] - self.assertEquals('pubsub.example.org', iq.getAttribute('to')) - self.assertEquals('get', iq.getAttribute('type')) - self.assertEquals('pubsub', iq.pubsub.name) - self.assertEquals(pubsub.NS_PUBSUB, iq.pubsub.uri) + self.assertEqual('pubsub.example.org', iq.getAttribute('to')) + self.assertEqual('get', iq.getAttribute('type')) + self.assertEqual('pubsub', iq.pubsub.name) + self.assertEqual(pubsub.NS_PUBSUB, iq.pubsub.uri) children = list(domish.generateElementsQNamed(iq.pubsub.children, 'items', pubsub.NS_PUBSUB)) - self.assertEquals(1, len(children)) + self.assertEqual(1, len(children)) child = children[0] - self.assertEquals('test', child['node']) + self.assertEqual('test', child['node']) set_elts = list(domish.generateElementsQNamed(iq.pubsub.children, 'set', NS_RSM)) - self.assertEquals(1, len(set_elts)) + self.assertEqual(1, len(set_elts)) set_elt = set_elts[0] - self.assertEquals(u'2', ''.join(set_elt.max.children)) - self.assertEquals(u'item2', ''.join(set_elt.after.children)) + self.assertEqual('2', ''.join(set_elt.max.children)) + self.assertEqual('item2', ''.join(set_elt.after.children)) response = toResponse(iq, 'result') items = response.addElement((pubsub.NS_PUBSUB, @@ -395,7 +395,7 @@ item1['id'] = 'item3' item2 = items.addElement('item') item2['id'] = 'item4' - RSMResponse(u'item3', u'item4', 2, 800).render(response.pubsub) + RSMResponse('item3', 'item4', 2, 800).render(response.pubsub) self.stub.send(response) return d @@ -406,31 +406,31 @@ """ def cb(response): items, rsm = response - self.assertEquals(2, len(items)) - self.assertEquals([item1, item2], items) - self.assertEquals(rsm, RSMResponse('item1', 'item2', 0, 800)) + self.assertEqual(2, len(items)) + self.assertEqual([item1, item2], items) + self.assertEqual(rsm, RSMResponse('item1', 'item2', 0, 800)) d = self.protocol.items(JID('pubsub.example.org'), 'test', - rsm_request=RSMRequest(2, before=u'item3')) + rsm_request=RSMRequest(2, before='item3')) d.addCallback(cb) iq = self.stub.output[-1] - self.assertEquals('pubsub.example.org', iq.getAttribute('to')) - self.assertEquals('get', iq.getAttribute('type')) - self.assertEquals('pubsub', iq.pubsub.name) - self.assertEquals(pubsub.NS_PUBSUB, iq.pubsub.uri) + self.assertEqual('pubsub.example.org', iq.getAttribute('to')) + self.assertEqual('get', iq.getAttribute('type')) + self.assertEqual('pubsub', iq.pubsub.name) + self.assertEqual(pubsub.NS_PUBSUB, iq.pubsub.uri) children = list(domish.generateElementsQNamed(iq.pubsub.children, 'items', pubsub.NS_PUBSUB)) - self.assertEquals(1, len(children)) + self.assertEqual(1, len(children)) child = children[0] - self.assertEquals('test', child['node']) + self.assertEqual('test', child['node']) set_elts = list(domish.generateElementsQNamed(iq.pubsub.children, 'set', NS_RSM)) - self.assertEquals(1, len(set_elts)) + self.assertEqual(1, len(set_elts)) set_elt = set_elts[0] - self.assertEquals(u'2', ''.join(set_elt.max.children)) - self.assertEquals(u'item3', ''.join(set_elt.before.children)) + self.assertEqual('2', ''.join(set_elt.max.children)) + self.assertEqual('item3', ''.join(set_elt.before.children)) response = toResponse(iq, 'result') items = response.addElement((pubsub.NS_PUBSUB, @@ -440,7 +440,7 @@ item1['id'] = 'item1' item2 = items.addElement('item') item2['id'] = 'item2' - RSMResponse(u'item1', u'item2', 0, 800).render(response.pubsub) + RSMResponse('item1', 'item2', 0, 800).render(response.pubsub) self.stub.send(response) return d @@ -451,31 +451,31 @@ """ def cb(response): items, rsm = response - self.assertEquals(3, len(items)) - self.assertEquals([item1, item2, item3], items) - self.assertEquals(rsm, RSMResponse('item4', 'item6', 3, 800)) + self.assertEqual(3, len(items)) + self.assertEqual([item1, item2, item3], items) + self.assertEqual(rsm, RSMResponse('item4', 'item6', 3, 800)) d = self.protocol.items(JID('pubsub.example.org'), 'test', rsm_request=RSMRequest(3, index=3)) d.addCallback(cb) iq = self.stub.output[-1] - self.assertEquals('pubsub.example.org', iq.getAttribute('to')) - self.assertEquals('get', iq.getAttribute('type')) - self.assertEquals('pubsub', iq.pubsub.name) - self.assertEquals(pubsub.NS_PUBSUB, iq.pubsub.uri) + self.assertEqual('pubsub.example.org', iq.getAttribute('to')) + self.assertEqual('get', iq.getAttribute('type')) + self.assertEqual('pubsub', iq.pubsub.name) + self.assertEqual(pubsub.NS_PUBSUB, iq.pubsub.uri) children = list(domish.generateElementsQNamed(iq.pubsub.children, 'items', pubsub.NS_PUBSUB)) - self.assertEquals(1, len(children)) + self.assertEqual(1, len(children)) child = children[0] - self.assertEquals('test', child['node']) + self.assertEqual('test', child['node']) set_elts = list(domish.generateElementsQNamed(iq.pubsub.children, 'set', NS_RSM)) - self.assertEquals(1, len(set_elts)) + self.assertEqual(1, len(set_elts)) set_elt = set_elts[0] - self.assertEquals(u'3', ''.join(set_elt.max.children)) - self.assertEquals(u'3', ''.join(set_elt.index.children)) + self.assertEqual('3', ''.join(set_elt.max.children)) + self.assertEqual('3', ''.join(set_elt.index.children)) response = toResponse(iq, 'result') items = response.addElement((pubsub.NS_PUBSUB, @@ -487,7 +487,7 @@ item2['id'] = 'item5' item3 = items.addElement('item') item3['id'] = 'item6' - RSMResponse(u'item4', u'item6', 3, 800).render(response.pubsub) + RSMResponse('item4', 'item6', 3, 800).render(response.pubsub) self.stub.send(response) return d @@ -498,29 +498,29 @@ """ def cb(response): items, rsm = response - self.assertEquals(0, len(items)) - self.assertEquals(rsm, RSMResponse(count=800)) + self.assertEqual(0, len(items)) + self.assertEqual(rsm, RSMResponse(count=800)) d = self.protocol.items(JID('pubsub.example.org'), 'test', rsm_request=RSMRequest(0)) d.addCallback(cb) iq = self.stub.output[-1] - self.assertEquals('pubsub.example.org', iq.getAttribute('to')) - self.assertEquals('get', iq.getAttribute('type')) - self.assertEquals('pubsub', iq.pubsub.name) - self.assertEquals(pubsub.NS_PUBSUB, iq.pubsub.uri) + self.assertEqual('pubsub.example.org', iq.getAttribute('to')) + self.assertEqual('get', iq.getAttribute('type')) + self.assertEqual('pubsub', iq.pubsub.name) + self.assertEqual(pubsub.NS_PUBSUB, iq.pubsub.uri) children = list(domish.generateElementsQNamed(iq.pubsub.children, 'items', pubsub.NS_PUBSUB)) - self.assertEquals(1, len(children)) + self.assertEqual(1, len(children)) child = children[0] - self.assertEquals('test', child['node']) + self.assertEqual('test', child['node']) set_elts = list(domish.generateElementsQNamed(iq.pubsub.children, 'set', NS_RSM)) - self.assertEquals(1, len(set_elts)) + self.assertEqual(1, len(set_elts)) set_elt = set_elts[0] - self.assertEquals(u'0', ''.join(set_elt.max.children)) + self.assertEqual('0', ''.join(set_elt.max.children)) response = toResponse(iq, 'result') response.addElement((pubsub.NS_PUBSUB, 'pubsub')) @@ -555,7 +555,7 @@ """ def items(request): - rsm = RSMResponse(u'item', u'item', 0, 800).toElement() + rsm = RSMResponse('item', 'item', 0, 800).toElement() return defer.succeed([pubsub.Item('current'), rsm]) def cb(element): @@ -597,7 +597,7 @@ """ def items(request): - rsm = RSMResponse(u'i1', u'i2', 3, 800).toElement() + rsm = RSMResponse('i1', 'i2', 3, 800).toElement() return defer.succeed([pubsub.Item('i1'), pubsub.Item('i2'), rsm]) def cb(element):
--- a/setup.py Tue Aug 13 18:58:08 2019 +0200 +++ b/setup.py Tue Aug 13 18:58:11 2019 +0200 @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # SàT tmp: repository to store temporary patches for third party software @@ -29,10 +29,10 @@ setup( name=NAME, version='0.8.0.dev0', - description=u'Salut à Toi temporary third party patches', - long_description=(u'This module is used by Salut à Toi project to patch third party ' - u'modules when the patches are not yet available upstream. Patches ' - u'are removed from this module once merged upstream.'), + description='Salut à Toi temporary third party patches', + long_description=('This module is used by Salut à Toi project to patch third party ' + 'modules when the patches are not yet available upstream. Patches ' + 'are removed from this module once merged upstream.'), author='Association « Salut à Toi »', author_email='contact@salut-a-toi.org', url='https://salut-a-toi.org',