mirror of
https://github.com/python/cpython.git
synced 2025-11-02 19:12:55 +00:00
add a test about hashing array.array
This commit is contained in:
parent
af45b11527
commit
2b6e4bc3ad
1 changed files with 9 additions and 0 deletions
|
|
@ -6,8 +6,10 @@
|
||||||
# Licensed to PSF under a Contributor Agreement.
|
# Licensed to PSF under a Contributor Agreement.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import array
|
||||||
import hashlib
|
import hashlib
|
||||||
import StringIO
|
import StringIO
|
||||||
|
import itertools
|
||||||
import sys
|
import sys
|
||||||
try:
|
try:
|
||||||
import threading
|
import threading
|
||||||
|
|
@ -94,6 +96,13 @@ class HashLibTestCase(unittest.TestCase):
|
||||||
|
|
||||||
super(HashLibTestCase, self).__init__(*args, **kwargs)
|
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):
|
def test_unknown_hash(self):
|
||||||
try:
|
try:
|
||||||
hashlib.new('spam spam spam spam spam')
|
hashlib.new('spam spam spam spam spam')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue