2019-03-15 17:44:41 +01:00
|
|
|
import unittest
|
2019-06-21 03:02:58 +02:00
|
|
|
from lbry.dht.protocol.distance import Distance
|
2019-03-15 17:44:41 +01:00
|
|
|
|
|
|
|
|
|
|
|
class DistanceTests(unittest.TestCase):
|
|
|
|
def test_invalid_key_length(self):
|
|
|
|
self.assertRaises(ValueError, Distance, b'1' * 47)
|
|
|
|
self.assertRaises(ValueError, Distance, b'1' * 49)
|
|
|
|
self.assertRaises(ValueError, Distance, b'')
|
|
|
|
|
|
|
|
self.assertRaises(ValueError, Distance(b'0' * 48), b'1' * 47)
|
|
|
|
self.assertRaises(ValueError, Distance(b'0' * 48), b'1' * 49)
|
|
|
|
self.assertRaises(ValueError, Distance(b'0' * 48), b'')
|