Terry J. Reedy <tjre...@udel.edu> added the comment:

With IDLE, I have issues with trying to test IDLE code without retesting 
tkinter, as well as deciding on the proper units of behavior to test.

Some suggestions: 
1. Add a docstring to the module with guidelines, after review from a couple of 
others.
For instance,I believe you are saying that no test should explicitly call 
compile.  Rather the test writer should call compile and extract the bytecode 
to copy into a test.

2. Make yourself a module code owner so you get informed and can review.  
Reviewing would be easier with guidelines to refer to, instead of repeating 
them.

3. An example issue is that some callables take many types of arguments.  If 
not already, tests that the function can extract the bytecode from various 
objects should be separate from tests that extracted bytecode is then handled 
properly.  Would any internal refactoring of dis and addition of _test 
functions make it easier to make test more independent of each other?

4. I would rather read the multiple long lists like

expected_opinfo_outer = [
  Instruction(opname='LOAD_CONST', opcode=100, arg=1, argval=3, argrepr='3', 
offset=0, starts_line=2, is_jump_target=False),
  Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=4, argrepr='4', 
offset=3, starts_line=None, is_jump_target=False),
  ...
]

condensed to

expected_opinfo_outer = [Instruction(opname, opcode, arg, argval, argrepr,
                                     offset, starts_line, is_jumps_target)
    for opname, opcode, arg, argval, argrepr, offset, starts_line, 
is_jumps_target in
(('LOAD_CONST', 100,    1,   3,     '3',      0,      2,           False),
 ('LOAD_CONST', 100,    2,   4,     '4',      3,      None,        False),
 ...
)]

----------
nosy: +terry.reedy

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46760>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to