Esempio n. 1
0
 def test_decrease_above_limit(self):
     mask = Mask(b'\xff' * Mask.MASK_BYTES)
     mask.decrease(Mask.MASK_LEN + 1)
     self.assertEqual(mask.num_bits, 0)
Esempio n. 2
0
 def test_decrease_below_limit(self):
     mask = Mask(b'\xff' * Mask.MASK_BYTES)
     with self.assertRaises(ValueError):
         mask.decrease(-1)
Esempio n. 3
0
 def test_decrease(self):
     mask = Mask(b'\xff' * Mask.MASK_BYTES)
     for i in range(Mask.MASK_LEN):
         self.assertEqual(mask.num_bits, Mask.MASK_LEN - i)
         mask.decrease()