MCPcopy Create free account
hub / github.com/ElementsProject/elements / parse_output

Function parse_output

test/util/test_runner.py:162–171  ·  view source on GitHub ↗

Parse the output according to specified format. Raise an error if the output can't be parsed.

(a, fmt)

Source from the content-addressed store, hash-verified

160 raise Exception
161
162def parse_output(a, fmt):
163 """Parse the output according to specified format.
164
165 Raise an error if the output can't be parsed."""
166 if fmt == 'json': # json: compare parsed data
167 return json.loads(a)
168 elif fmt == 'hex': # hex: parse and compare binary data
169 return bytes.fromhex(a.strip())
170 else:
171 raise NotImplementedError("Don't know how to compare %s" % fmt)
172
173if __name__ == '__main__':
174 main()

Callers 1

bctestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected