Example #1
0
 def test_padding(self):
     self.assertEqual(int_to_bits(127), '01111111')
     self.assertEqual(int_to_bits(127, padding=2), '01111111')
     self.assertEqual(int_to_bits(127, padding=3), '001111111')
     self.assertEqual(int_to_bits(127, padding=5), '0001111111')
     self.assertEqual(int_to_bits(127, padding=6), '000001111111')
     self.assertEqual(int_to_bits(127, padding=7), '1111111')
Example #2
0
 def test_two_bytes(self):
     self.assertEqual(int_to_bits(256), '0000000100000000')
     self.assertEqual(int_to_bits(511), '0000000111111111')
Example #3
0
 def test_one(self):
     self.assertEqual(int_to_bits(1), '00000001')
Example #4
0
 def test_full_byte(self):
     self.assertEqual(int_to_bits(255), '11111111')
Example #5
0
 def test_zero(self):
     self.assertEqual(int_to_bits(0), '00000000')