def test_pull_uint16_truncated(self): buf = Buffer(capacity=1) with self.assertRaises(BufferReadError): buf.pull_uint16() self.assertEqual(buf.tell(), 0)
def test_pull_uint16(self): buf = Buffer(data=b"\x08\x07\x06\x05\x04\x03\x02\x01") self.assertEqual(buf.pull_uint16(), 0x0807) self.assertEqual(buf.tell(), 2)