Replace hex with "0x%x" % ... to fix a trailing 'L' on 32-bit python2
This test was failing because the hash computes values greater than 0x7fffffff, which 32-bit python2 promotes to long, which `hex` formats with a trailing 'L'. The code that uses it appears to be ok with a long value, so it's just the test that needs to handle it. Fix as suggested here: https://stackoverflow.com/questions/5917203/python-trailing-l-problem
This commit is contained in:
@@ -20,9 +20,9 @@ def simple_hash(s):
|
||||
Compute a primitive hash of a string.
|
||||
|
||||
Example:
|
||||
>>> hex(simple_hash("Hello"))
|
||||
>>> "0x%x" % simple_hash("Hello")
|
||||
'0x2fa70c01'
|
||||
>>> hex(simple_hash("world"))
|
||||
>>> "0x%x" % simple_hash("world")
|
||||
'0x5b0c31d5'
|
||||
"""
|
||||
h = 5381
|
||||
|
||||
Reference in New Issue
Block a user