]> granicus.if.org Git - python/commitdiff
add a test about hashing array.array
authorBenjamin Peterson <benjamin@python.org>
Tue, 5 Jan 2010 00:04:19 +0000 (00:04 +0000)
committerBenjamin Peterson <benjamin@python.org>
Tue, 5 Jan 2010 00:04:19 +0000 (00:04 +0000)
Lib/test/test_hashlib.py

index 751d1f6a8b76f14c18973fb6b8b7cd5cfabf7200..b5fee5151a5197159776df4bbd0a6ac14222b5f8 100644 (file)
@@ -6,8 +6,10 @@
 #  Licensed to PSF under a Contributor Agreement.
 #
 
+import array
 import hashlib
 import StringIO
+import itertools
 import sys
 try:
     import threading
@@ -94,6 +96,13 @@ class HashLibTestCase(unittest.TestCase):
 
         super(HashLibTestCase, self).__init__(*args, **kwargs)
 
+    def test_hash_array(self):
+        a = array.array("b", range(10))
+        constructors = self.constructors_to_test.itervalues()
+        for cons in itertools.chain.from_iterable(constructors):
+            c = cons(a)
+            c.hexdigest()
+
     def test_unknown_hash(self):
         try:
             hashlib.new('spam spam spam spam spam')