Add a test for sha1_hash
This commit is contained in:
parent
a5010fd7af
commit
e8efc8fd00
|
@ -3,6 +3,7 @@
|
||||||
import libtorrent as lt
|
import libtorrent as lt
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
import binascii
|
||||||
|
|
||||||
# test torrent_info
|
# test torrent_info
|
||||||
|
|
||||||
|
@ -33,6 +34,13 @@ class test_bencoder(unittest.TestCase):
|
||||||
decoded = lt.bdecode(encoded)
|
decoded = lt.bdecode(encoded)
|
||||||
self.assertEqual(decoded, {'a': 1, 'b': [1,2,3], 'c': 'foo'})
|
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__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue