Tests pass on Python 3.

This commit is contained in:
Itamar Turner-Trauring 2021-01-04 11:03:38 -05:00
parent 855521fea8
commit 744e205763
2 changed files with 7 additions and 9 deletions

View File

@ -1,7 +1,5 @@
from six import ensure_str
from types import NoneType
from zope.interface import implementer
from twisted.application import service, strports
from twisted.internet import defer
@ -264,7 +262,7 @@ class Handler(object):
d.addCallback(_list)
def _render(children):
results = []
for (name, childnode) in children.iteritems():
for (name, childnode) in children.items():
# the interface claims that the result should have a unicode
# object as the name, but it fails unless you give it a
# bytestring
@ -317,7 +315,7 @@ class Dispatcher(object):
class FTPServer(service.MultiService):
def __init__(self, client, accountfile, accounturl, ftp_portstr):
precondition(isinstance(accountfile, (unicode, NoneType)), accountfile)
precondition(isinstance(accountfile, (unicode, type(None))), accountfile)
service.MultiService.__init__(self)
r = Dispatcher(client)

View File

@ -46,7 +46,7 @@ class Handler(GridTestMixin, ReallyEqualMixin, unittest.TestCase):
def _set_up_tree(self):
# add immutable file at root
immutable = upload.Data("immutable file contents", None)
immutable = upload.Data(b"immutable file contents", None)
d = self.root.add_file(u"immutable", immutable)
# `mtime' and `linkmotime' both set
@ -62,7 +62,7 @@ class Handler(GridTestMixin, ReallyEqualMixin, unittest.TestCase):
d.addCallback(lambda _: self._set_metadata(u"loop", md_just_mtime))
# add mutable file at root
mutable = publish.MutableData("mutable file contents")
mutable = publish.MutableData(b"mutable file contents")
d.addCallback(lambda _: self.client.create_mutable_file(mutable))
d.addCallback(lambda node: self.root.set_node(u"mutable", node))
@ -93,11 +93,11 @@ class Handler(GridTestMixin, ReallyEqualMixin, unittest.TestCase):
d.addCallback(lambda _: self.handler.list("", keys=keys))
expected_root = [
('loop',
(b'loop',
[0, True, ftpd.IntishPermissions(0o600), 1, self.FALL_OF_BERLIN_WALL, 'alice', 'alice', '??']),
('immutable',
(b'immutable',
[23, False, ftpd.IntishPermissions(0o600), 1, self.TURN_OF_MILLENIUM, 'alice', 'alice', '??']),
('mutable',
(b'mutable',
# timestamp should be 0 if no timestamp metadata is present
[0, False, ftpd.IntishPermissions(0o600), 1, 0, 'alice', 'alice', '??'])]