MCPcopy
hub / github.com/petertodd/python-bitcoinlib / test_serializationDiff

Method test_serializationDiff

bitcoin/tests/test_net.py:97–119  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

95 self.assertEqual(cSerialized, cSerializedTwice)
96
97 def test_serializationDiff(self):
98 # Sanity check that the serialization code preserves differences
99 c1 = CAddress()
100 c1.ip = "1.1.1.1"
101 c1.port = 8333
102 c1.nTime = 1420576401
103
104 c2 = CAddress()
105 c2.ip = "1.1.1.2"
106 c2.port = 8333
107 c2.nTime = 1420576401
108
109 self.assertNotEqual(c1, c2)
110
111 c1Serialized = c1.serialize()
112 c2Serialized = c2.serialize()
113
114 self.assertNotEqual(c1Serialized, c2Serialized)
115
116 c1Deserialized = CAddress.deserialize(c1Serialized)
117 c2Deserialized = CAddress.deserialize(c2Serialized)
118
119 self.assertNotEqual(c1Deserialized, c2Deserialized)

Callers

nothing calls this directly

Calls 3

CAddressClass · 0.90
serializeMethod · 0.45
deserializeMethod · 0.45

Tested by

no test coverage detected