예제 #1
0
파일: test_bucket.py 프로젝트: ntoll/p4p2p
 def test_key_in_range_handles_string(self):
     """
     Ensures the keyInRange method decodes a string representation of a key
     correctly, before testing if it's within range.
     """
     bucket = Bucket(1, 66)
     self.assertTrue(bucket.key_in_range('0xA'))
예제 #2
0
파일: test_bucket.py 프로젝트: ntoll/p4p2p
 def test_key_in_range_no_too_low(self):
     """
     Ensures a key just below the k-bucket's range is identified as out of
     range.
     """
     bucket = Bucket(5, 9)
     self.assertFalse(bucket.key_in_range(2))
예제 #3
0
파일: test_bucket.py 프로젝트: ntoll/p4p2p
 def test_key_in_range_no_too_high(self):
     """
     Ensures a key just above the k-bucket's range is identified as out of
     range.
     """
     bucket = Bucket(1, 5)
     self.assertFalse(bucket.key_in_range(7))
예제 #4
0
파일: test_bucket.py 프로젝트: ntoll/p4p2p
 def test_key_in_range_yes(self):
     """
     Ensures that a key within the appropriate range is identified as such.
     """
     bucket = Bucket(1, 9)
     self.assertTrue(bucket.key_in_range(2))