MCPcopy
hub / github.com/rocky/python-uncompyle6 / compare_ok

Function compare_ok

test/dis-compare.py:39–63  ·  view source on GitHub ↗
(version, co)

Source from the content-addressed store, hash-verified

37 return
38
39def compare_ok(version, co):
40 out = StringIO()
41 if version in (2.6, 2.7):
42 print("Doesn't work on %d\n yet" % version)
43 # dis.disco(co)
44 return True
45
46 bytecode = dis.Bytecode(co)
47
48 disco(version, co, out)
49 got_lines = out.getvalue().split("\n")[2:]
50 i = 0
51 good_lines = "\n".join([inst_fmt(inst) for inst in bytecode]).split("\n")
52 for good_line in good_lines:
53 if '\tCOME_FROM ' in got_lines[i]:
54 i += 1
55
56 if got_lines[i] != good_line:
57 print('line %d %s' % (i+1, ('=' * 30)))
58 print(good_line)
59 print("vs %s" % ('-' * 10))
60 print(got_lines[i])
61 return False
62 i += 1
63 return True
64
65check_python_version(program)
66

Callers 1

dis-compare.pyFile · 0.85

Calls 4

StringIOClass · 0.85
discoFunction · 0.85
inst_fmtFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected