Esempio n. 1
0
 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'))
Esempio n. 2
0
 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))
Esempio n. 3
0
 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))
Esempio n. 4
0
 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))