tests/test-hashutil.py
branchstable
changeset 49366 288de6f5d724
parent 48946 642e31cb55f0
equal deleted inserted replaced
49364:e8ea403b1c46 49366:288de6f5d724
     1 # Tests to ensure that sha1dc.sha1 is exactly a drop-in for
     1 # Tests to ensure that sha1dc.sha1 is exactly a drop-in for
     2 # hashlib.sha1 for our needs.
     2 # hashlib.sha1 for our needs.
     3 from __future__ import absolute_import
       
     4 
     3 
     5 import hashlib
     4 import hashlib
     6 import unittest
     5 import unittest
     7 
     6 
     8 import silenttestrunner
     7 import silenttestrunner
    11     from mercurial.thirdparty import sha1dc
    10     from mercurial.thirdparty import sha1dc
    12 except ImportError:
    11 except ImportError:
    13     sha1dc = None
    12     sha1dc = None
    14 
    13 
    15 
    14 
    16 class hashertestsbase(object):
    15 class hashertestsbase:
    17     def test_basic_hash(self):
    16     def test_basic_hash(self):
    18         h = self.hasher()
    17         h = self.hasher()
    19         h.update(b'foo')
    18         h.update(b'foo')
    20         self.assertEqual(
    19         self.assertEqual(
    21             '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33', h.hexdigest()
    20             '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33', h.hexdigest()