示例#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)
示例#2
0
 def test_decrease_below_limit(self):
     mask = Mask(b'\xff' * Mask.MASK_BYTES)
     with self.assertRaises(ValueError):
         mask.decrease(-1)
示例#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()