mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-06-01 15:20:55 +00:00
A few more explicit byte strings.
This commit is contained in:
parent
85c8ca6d77
commit
15254d08fc
@ -1,5 +1,15 @@
|
|||||||
# -*- test-case-name: allmydata.test.test_hashtree -*-
|
# -*- test-case-name: allmydata.test.test_hashtree -*-
|
||||||
|
|
||||||
|
from __future__ import absolute_import
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from future.utils import PY2
|
||||||
|
if PY2:
|
||||||
|
from builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, int, list, object, range, str, max, min # noqa: F401
|
||||||
|
|
||||||
|
|
||||||
from twisted.trial import unittest
|
from twisted.trial import unittest
|
||||||
|
|
||||||
from allmydata.util.hashutil import tagged_hash
|
from allmydata.util.hashutil import tagged_hash
|
||||||
@ -143,7 +153,7 @@ class Incomplete(unittest.TestCase):
|
|||||||
current_hashes = list(iht)
|
current_hashes = list(iht)
|
||||||
# this should fail because there aren't enough hashes known
|
# this should fail because there aren't enough hashes known
|
||||||
try:
|
try:
|
||||||
iht.set_hashes(leaves={0: tagged_hash("tag", "0")})
|
iht.set_hashes(leaves={0: tagged_hash(b"tag", b"0")})
|
||||||
except hashtree.NotEnoughHashesError:
|
except hashtree.NotEnoughHashesError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
@ -173,7 +183,7 @@ class Incomplete(unittest.TestCase):
|
|||||||
self.fail("didn't catch bad hash")
|
self.fail("didn't catch bad hash")
|
||||||
|
|
||||||
bad_chain = chain.copy()
|
bad_chain = chain.copy()
|
||||||
bad_chain[2] = ht[2] + "BOGUS"
|
bad_chain[2] = ht[2] + b"BOGUS"
|
||||||
|
|
||||||
# this should fail because the internal hash is wrong
|
# this should fail because the internal hash is wrong
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user