Merge pull request #602 from tahoe-lafs/3027-remove-backticks

removed use of backticks for repr for python3 compatibility
This commit is contained in:
meejah 2019-04-23 17:49:50 +00:00 committed by GitHub
commit 318be89497
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 2 deletions

1
newsfragments/3027.other Normal file
View File

@ -0,0 +1 @@
Removed used of backticks for "repr" for Python3 compatibility.

View File

@ -12,7 +12,7 @@ class T(unittest.TestCase):
def _test_ende(self, bs):
ascii=base62.b2a(bs)
bs2=base62.a2b(ascii)
assert bs2 == bs, "bs2: %s:%s, bs: %s:%s, ascii: %s:%s" % (len(bs2), `bs2`, len(bs), `bs`, len(ascii), `ascii`)
assert bs2 == bs, "bs2: %s:%s, bs: %s:%s, ascii: %s:%s" % (len(bs2), repr(bs2), len(bs), repr(bs), len(ascii), repr(ascii))
def test_num_octets_that_encode_to_this_many_chars(self):
return self._test_num_octets_that_encode_to_this_many_chars(2, 1)

View File

@ -26,7 +26,7 @@ class BetterRepr(Repr):
return '<' + obj.im_class.__name__ + '.' + obj.im_func.__name__ + '() at (builtin)'
def repr_long(self, obj, level):
s = `obj` # XXX Hope this isn't too slow...
s = repr(obj) # XXX Hope this isn't too slow...
if len(s) > self.maxlong:
i = max(0, (self.maxlong-3)/2)
j = max(0, self.maxlong-3-i)