Back to index

python3.2  3.2.2
Public Member Functions
test.test_pep247.Pep247Test Class Reference

List of all members.

Public Member Functions

def check_module
def check_object
def test_md5
def test_sha
def test_hmac

Detailed Description

Definition at line 11 of file test_pep247.py.


Member Function Documentation

def test.test_pep247.Pep247Test.check_module (   self,
  module,
  key = None 
)

Definition at line 13 of file test_pep247.py.

00013 
00014     def check_module(self, module, key=None):
00015         self.assertTrue(hasattr(module, 'digest_size'))
00016         self.assertTrue(module.digest_size is None or module.digest_size > 0)
00017         self.check_object(module.new, module.digest_size, key)

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_pep247.Pep247Test.check_object (   self,
  cls,
  digest_size,
  key 
)

Definition at line 18 of file test_pep247.py.

00018 
00019     def check_object(self, cls, digest_size, key):
00020         if key is not None:
00021             obj1 = cls(key)
00022             obj2 = cls(key, b'string')
00023             h1 = cls(key, b'string').digest()
00024             obj3 = cls(key)
00025             obj3.update(b'string')
00026             h2 = obj3.digest()
00027         else:
00028             obj1 = cls()
00029             obj2 = cls(b'string')
00030             h1 = cls(b'string').digest()
00031             obj3 = cls()
00032             obj3.update(b'string')
00033             h2 = obj3.digest()
00034         self.assertEqual(h1, h2)
00035         self.assertTrue(hasattr(obj1, 'digest_size'))
00036 
00037         if digest_size is not None:
00038             self.assertEqual(obj1.digest_size, digest_size)
00039 
00040         self.assertEqual(obj1.digest_size, len(h1))
00041         obj1.update(b'string')
00042         obj_copy = obj1.copy()
00043         self.assertEqual(obj1.digest(), obj_copy.digest())
00044         self.assertEqual(obj1.hexdigest(), obj_copy.hexdigest())
00045 
00046         digest, hexdigest = obj1.digest(), obj1.hexdigest()
00047         hd2 = ""
00048         for byte in digest:
00049             hd2 += '%02x' % byte
00050         self.assertEqual(hd2, hexdigest)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 61 of file test_pep247.py.

00061 
00062     def test_hmac(self):
00063         self.check_module(hmac, key=b'abc')

Here is the call graph for this function:

Definition at line 51 of file test_pep247.py.

00051 
00052     def test_md5(self):
00053         self.check_object(md5, None, None)

Here is the call graph for this function:

Definition at line 54 of file test_pep247.py.

00054 
00055     def test_sha(self):
00056         self.check_object(sha1, None, None)
00057         self.check_object(sha224, None, None)
00058         self.check_object(sha256, None, None)
00059         self.check_object(sha384, None, None)
00060         self.check_object(sha512, None, None)

Here is the call graph for this function:


The documentation for this class was generated from the following file: