Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

  • Loading branch information...
commit c1584890b1764831309eba393eba74afba39487d 1 parent f2fff84
Florian Apolloner authored

Showing 1 changed file with 3 additions and 3 deletions. Show diff stats Hide diff stats

  1. 6  tests/regressiontests/cache/tests.py
6  tests/regressiontests/cache/tests.py
@@ -364,7 +364,7 @@ def test_binary_string(self):
364 364
         # Binary strings should be cacheable
365 365
         from zlib import compress, decompress
366 366
         value = 'value_to_be_compressed'
367  
-        compressed_value = compress(value)
  367
+        compressed_value = compress(value.encode())
368 368
 
369 369
         # Test set
370 370
         self.cache.set('binary1', compressed_value)
@@ -988,7 +988,7 @@ def test_hashing(self):
988 988
         """Test that keys are hashed into subdirectories correctly"""
989 989
         self.cache.set("foo", "bar")
990 990
         key = self.cache.make_key("foo")
991  
-        keyhash = hashlib.md5(key).hexdigest()
  991
+        keyhash = hashlib.md5(key.encode()).hexdigest()
992 992
         keypath = os.path.join(self.dirname, keyhash[:2], keyhash[2:4], keyhash[4:])
993 993
         self.assertTrue(os.path.exists(keypath))
994 994
 
@@ -998,7 +998,7 @@ def test_subdirectory_removal(self):
998 998
         """
999 999
         self.cache.set("foo", "bar")
1000 1000
         key = self.cache.make_key("foo")
1001  
-        keyhash = hashlib.md5(key).hexdigest()
  1001
+        keyhash = hashlib.md5(key.encode()).hexdigest()
1002 1002
         keypath = os.path.join(self.dirname, keyhash[:2], keyhash[2:4], keyhash[4:])
1003 1003
         self.assertTrue(os.path.exists(keypath))
1004 1004
 

0 notes on commit c158489

Please sign in to comment.
Something went wrong with that request. Please try again.