示例#1
0
 def test_minwidth(self):
     self.assertEquals(
         len(BitPaddedInt.to_bytes(100, width=-1, minwidth=6)), 6)
示例#2
0
 def test_w129l(self):
     self.assertEquals(
         BitPaddedInt.to_bytes(129, width=2, bigendian=False), b'\x01\x01')
示例#3
0
 def test_varwidth(self):
     self.assertEquals(len(BitPaddedInt.to_bytes(100)), 4)
     self.assertEquals(len(BitPaddedInt.to_bytes(100, width=-1)), 4)
     self.assertEquals(len(BitPaddedInt.to_bytes(2**32, width=-1)), 5)
示例#4
0
 def test_w129(self):
     self.assertEquals(BitPaddedInt.to_bytes(129, width=2), b'\x01\x01')
示例#5
0
 def test_s65(self):
     self.assertEquals(BitPaddedInt.to_bytes(0x41, 6), b'\x00\x00\x01\x01')
示例#6
0
 def test_s129(self):
     self.assertEquals(BitPaddedInt.to_bytes(129), b'\x00\x00\x01\x01')
示例#7
0
 def test_s1l(self):
     self.assertEquals(
         BitPaddedInt.to_bytes(1, bigendian=False), b'\x01\x00\x00\x00')
示例#8
0
 def test_s0(self):
     self.assertEquals(BitPaddedInt.to_bytes(0), b'\x00\x00\x00\x00')