Exemple #1
0
 def test_small_unsigned_encode(self):
     buffer = io.BytesIO()
     encode(buffer, 4)
     self.assertIsEncoded(buffer, '04')
Exemple #2
0
 def test_8byte_signed_encode(self):
     buffer = io.BytesIO()
     encode(buffer, -0xEDEFABCD01234567)
     self.assertIsEncoded(buffer, 'D3EDEFABCD01234567')
Exemple #3
0
 def test_4byte_signed_encode(self):
     buffer = io.BytesIO()
     encode(buffer, -0xEDEFABCD)
     self.assertIsEncoded(buffer, 'D2EDEFABCD')
Exemple #4
0
 def test_2byte_signed_encode(self):
     buffer = io.BytesIO()
     encode(buffer, -0xEDEF)
     self.assertIsEncoded(buffer, 'D1EDEF')
Exemple #5
0
 def test_1byte_signed_encode(self):
     buffer = io.BytesIO()
     encode(buffer, -0x80)
     self.assertIsEncoded(buffer, 'D080')
Exemple #6
0
 def test_invalid_large_integer(self):
     too_big = 1 << 64
     buffer = io.BytesIO()
     with self.assertRaises(RuntimeError):
         encode(buffer, too_big)