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

Method test_repr

bitcoin/tests/test_script.py:225–256  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

223 self.assertEqual(script, b'\x09\x00\x00\x00\x00\x00\x00\x00\x00\x01')
224
225 def test_repr(self):
226 def T(script, expected_repr):
227 actual_repr = repr(script)
228 self.assertEqual(actual_repr, expected_repr)
229
230 T( CScript([]),
231 'CScript([])')
232
233 T( CScript([1]),
234 'CScript([1])')
235
236 T( CScript([1, 2, 3]),
237 'CScript([1, 2, 3])')
238
239 T( CScript([1, x('7ac977d8373df875eceda362298e5d09d4b72b53'), OP_DROP]),
240 "CScript([1, x('7ac977d8373df875eceda362298e5d09d4b72b53'), OP_DROP])")
241
242 T(CScript(x('0001ff515261ff')),
243 "CScript([0, x('ff'), 1, 2, OP_NOP, OP_INVALIDOPCODE])")
244
245 # truncated scripts
246 T(CScript(x('6101')),
247 "CScript([OP_NOP, x('')...<ERROR: PUSHDATA(1): truncated data>])")
248
249 T(CScript(x('614bff')),
250 "CScript([OP_NOP, x('ff')...<ERROR: PUSHDATA(75): truncated data>])")
251
252 T(CScript(x('614c')),
253 "CScript([OP_NOP, <ERROR: PUSHDATA1: missing data length>])")
254
255 T(CScript(x('614c0200')),
256 "CScript([OP_NOP, x('00')...<ERROR: PUSHDATA1: truncated data>])")
257
258 def test_is_p2sh(self):
259 def T(serialized, b):

Callers

nothing calls this directly

Calls 2

xFunction · 0.90
CScriptClass · 0.85

Tested by

no test coverage detected