mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-09 03:44:23 +00:00
Python 2 tests pass again.
This commit is contained in:
parent
c5ce988c7e
commit
7b302871e4
@ -1,4 +1,4 @@
|
||||
from past.builtins import long
|
||||
from past.builtins import long, unicode
|
||||
|
||||
import os, time, weakref, itertools
|
||||
from zope.interface import implementer
|
||||
@ -1500,7 +1500,7 @@ class AssistedUploader(object):
|
||||
|
||||
Returns a Deferred that will fire with the UploadResults instance.
|
||||
"""
|
||||
precondition(isinstance(storage_index, str), storage_index)
|
||||
precondition(isinstance(storage_index, bytes), storage_index)
|
||||
self._started = time.time()
|
||||
eu = IEncryptedUploadable(encrypted_uploadable)
|
||||
eu.set_upload_status(self._upload_status)
|
||||
@ -1653,7 +1653,7 @@ class BaseUploadable(object):
|
||||
def set_default_encoding_parameters(self, default_params):
|
||||
assert isinstance(default_params, dict)
|
||||
for k,v in default_params.items():
|
||||
precondition(isinstance(k, str), k, v)
|
||||
precondition(isinstance(k, (bytes, unicode)), k, v)
|
||||
precondition(isinstance(v, int), k, v)
|
||||
if "k" in default_params:
|
||||
self.default_encoding_param_k = default_params["k"]
|
||||
@ -1773,7 +1773,7 @@ class FileName(FileHandle):
|
||||
then the hash will be hashed together with the string in the
|
||||
"convergence" argument to form the encryption key.
|
||||
"""
|
||||
assert convergence is None or isinstance(convergence, str), (convergence, type(convergence))
|
||||
assert convergence is None or isinstance(convergence, bytes), (convergence, type(convergence))
|
||||
FileHandle.__init__(self, open(filename, "rb"), convergence=convergence)
|
||||
def close(self):
|
||||
FileHandle.close(self)
|
||||
|
@ -274,7 +274,7 @@ class Encode(unittest.TestCase):
|
||||
data = make_data(datalen)
|
||||
# force use of multiple segments
|
||||
e = encode.Encoder()
|
||||
u = upload.Data(data, convergence="some convergence string")
|
||||
u = upload.Data(data, convergence=b"some convergence string")
|
||||
u.set_default_encoding_parameters({'max_segment_size': max_segment_size,
|
||||
'k': 25, 'happy': 75, 'n': 100})
|
||||
eu = upload.EncryptAnUploadable(u)
|
||||
@ -304,7 +304,7 @@ class Encode(unittest.TestCase):
|
||||
|
||||
def _check(res):
|
||||
verifycap = res
|
||||
self.failUnless(isinstance(verifycap.uri_extension_hash, str))
|
||||
self.failUnless(isinstance(verifycap.uri_extension_hash, bytes))
|
||||
self.failUnlessEqual(len(verifycap.uri_extension_hash), 32)
|
||||
for i,peer in enumerate(all_shareholders):
|
||||
self.failUnless(peer.closed)
|
||||
|
Loading…
x
Reference in New Issue
Block a user