def test_deserialize_from_stream(self): data_uint160 = bytearray(20 * [0x11]) data_uint256 = bytearray(32 * [0x11]) with serialization.BinaryReader(data_uint160) as br: # we explicitly call deserialize, instead of br.read_uint160() for coverage uint160 = UInt160.zero() uint160.deserialize(br) self.assertEqual(data_uint160, uint160._data) with serialization.BinaryReader(data_uint256) as br: uint256 = UInt256.zero() uint256.deserialize(br) self.assertEqual(data_uint256, uint256._data)
def test_zero(self): uint160 = UInt160.zero() self.assertEqual(20, len(uint160.to_array())) uint256 = UInt256.zero() self.assertEqual(32, len(uint256.to_array()))