MCPcopy Index your code
hub / github.com/jimmysong/programmingbitcoin / test_parse

Method test_parse

code-ch13/script.py:295–301  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

293class ScriptTest(TestCase):
294
295 def test_parse(self):
296 script_pubkey = BytesIO(bytes.fromhex('6a47304402207899531a52d59a6de200179928ca900254a36b8dff8bb75f5f5d71b1cdc26125022008b422690b8461cb52c3cc30330b23d574351872b7c361e9aae3649071c1a7160121035d5c93d9ac96881f19ba1f686f15f009ded7c62efe85a872e6a19b43c15a2937'))
297 script = Script.parse(script_pubkey)
298 want = bytes.fromhex('304402207899531a52d59a6de200179928ca900254a36b8dff8bb75f5f5d71b1cdc26125022008b422690b8461cb52c3cc30330b23d574351872b7c361e9aae3649071c1a71601')
299 self.assertEqual(script.cmds[0].hex(), want.hex())
300 want = bytes.fromhex('035d5c93d9ac96881f19ba1f686f15f009ded7c62efe85a872e6a19b43c15a2937')
301 self.assertEqual(script.cmds[1], want)
302
303 def test_serialize(self):
304 want = '6a47304402207899531a52d59a6de200179928ca900254a36b8dff8bb75f5f5d71b1cdc26125022008b422690b8461cb52c3cc30330b23d574351872b7c361e9aae3649071c1a7160121035d5c93d9ac96881f19ba1f686f15f009ded7c62efe85a872e6a19b43c15a2937'

Callers

nothing calls this directly

Calls 2

parseMethod · 0.45
hexMethod · 0.45

Tested by

no test coverage detected