Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[py3] Properly encode hashlib.md5 and zip.compress args in the tests.

  • Loading branch information...
commit c1584890b1764831309eba393eba74afba39487d 1 parent f2fff84
@apollo13 apollo13 authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 tests/regressiontests/cache/tests.py
View
6 tests/regressiontests/cache/tests.py
@@ -364,7 +364,7 @@ def test_binary_string(self):
# Binary strings should be cacheable
from zlib import compress, decompress
value = 'value_to_be_compressed'
- compressed_value = compress(value)
+ compressed_value = compress(value.encode())
# Test set
self.cache.set('binary1', compressed_value)
@@ -988,7 +988,7 @@ def test_hashing(self):
"""Test that keys are hashed into subdirectories correctly"""
self.cache.set("foo", "bar")
key = self.cache.make_key("foo")
- keyhash = hashlib.md5(key).hexdigest()
+ keyhash = hashlib.md5(key.encode()).hexdigest()
keypath = os.path.join(self.dirname, keyhash[:2], keyhash[2:4], keyhash[4:])
self.assertTrue(os.path.exists(keypath))
@@ -998,7 +998,7 @@ def test_subdirectory_removal(self):
"""
self.cache.set("foo", "bar")
key = self.cache.make_key("foo")
- keyhash = hashlib.md5(key).hexdigest()
+ keyhash = hashlib.md5(key.encode()).hexdigest()
keypath = os.path.join(self.dirname, keyhash[:2], keyhash[2:4], keyhash[4:])
self.assertTrue(os.path.exists(keypath))
Please sign in to comment.
Something went wrong with that request. Please try again.