Merge pull request #216 from aresch/master

Add a test for sha1_hash
This commit is contained in:
Arvid Norberg 2015-10-10 19:00:02 -04:00
commit ee58035d9d
1 changed files with 8 additions and 0 deletions

View File

@ -3,6 +3,7 @@
import libtorrent as lt
import unittest
import binascii
# test torrent_info
@ -33,6 +34,13 @@ class test_bencoder(unittest.TestCase):
decoded = lt.bdecode(encoded)
self.assertEqual(decoded, {'a': 1, 'b': [1,2,3], 'c': 'foo'})
class test_sha1hash(unittest.TestCase):
def test_sha1hash(self):
h = 'a0'*20
s = lt.sha1_hash(binascii.unhexlify(h))
self.assertEqual(h, str(s))
if __name__ == '__main__':
unittest.main()