(1, 0) (1, 22) COMMENT '#!/usr/bin/env python2' (1, 22) (1, 23) NL '\n' (2, 0) (4, 3) STRING '"""\nword_compile_test.py: Tests for word_compile.py\n"""' (4, 3) (4, 4) NEWLINE '\n' (5, 0) (5, 1) NL '\n' (6, 0) (6, 6) NAME 'import' (6, 7) (6, 15) NAME 'unittest' (6, 15) (6, 16) NEWLINE '\n' (7, 0) (7, 1) NL '\n' (8, 0) (8, 51) COMMENT '#from core import word_compile # module under test' (8, 51) (8, 52) NL '\n' (9, 0) (9, 1) NL '\n' (10, 0) (10, 1) NL '\n' (11, 0) (11, 5) NAME 'class' (11, 6) (11, 21) NAME 'WordCompileTest' (11, 21) (11, 22) OP '(' (11, 22) (11, 30) NAME 'unittest' (11, 30) (11, 31) OP '.' (11, 31) (11, 39) NAME 'TestCase' (11, 39) (11, 40) OP ')' (11, 40) (11, 41) OP ':' (11, 41) (11, 42) NEWLINE '\n' (12, 0) (12, 2) INDENT ' ' (12, 2) (12, 6) NAME 'pass' (12, 6) (12, 7) NEWLINE '\n' (13, 0) (13, 1) NL '\n' (14, 0) (14, 1) NL '\n' (15, 0) (15, 0) DEDENT '' (15, 0) (15, 2) NAME 'if' (15, 3) (15, 11) NAME '__name__' (15, 12) (15, 14) OP '==' (15, 15) (15, 25) STRING "'__main__'" (15, 25) (15, 26) OP ':' (15, 26) (15, 27) NEWLINE '\n' (16, 0) (16, 2) INDENT ' ' (16, 2) (16, 10) NAME 'unittest' (16, 10) (16, 11) OP '.' (16, 11) (16, 15) NAME 'main' (16, 15) (16, 16) OP '(' (16, 16) (16, 17) OP ')' (16, 17) (16, 18) NEWLINE '\n' (17, 0) (17, 0) DEDENT '' (17, 0) (17, 0) ENDMARKER '' OK lex Module( doc = '\nword_compile_test.py: Tests for word_compile.py\n' node = Stmt( nodes = [ Import( names = [ ( 'unittest' None ) ] ) # Import Class( name = 'WordCompileTest' bases = [ Getattr( expr = Name( name = 'unittest' ) # Name attrname = 'TestCase' ) # Getattr ] doc = None code = Stmt( nodes = [ Pass( ) # Pass ] ) # Stmt decorators = None ) # Class If( tests = [ ( Compare( expr = Name( name = '__name__' ) # Name ops = [ ( '==' Const( value = '__main__' ) # Const ) ] ) # Compare Stmt( nodes = [ Discard( expr = CallFunc( node = Getattr( expr = Name( name = 'unittest' ) # Name attrname = 'main' ) # Getattr args = [ ] star_args = None dstar_args = None ) # CallFunc ) # Discard ] ) # Stmt ) ] else_ = None ) # If ] ) # Stmt ) # Module OK ast globals: cells: defs: WordCompileTest unittest uses: __name__ unittest frees: globals: cells: defs: __module__ uses: frees: OK symbols OK cfg 55 OK run Compiled to 72 bytes of top-level bytecode co_argcount: 0 co_cellvars: () co_filename: 'osh/word_compile_test.py' co_firstlineno: 6 co_flags: 0x00000 co_freevars: () co_lnotab: '\x12\x05\x19\x04\x0c\x01' co_name: '' co_names: ('__doc__', 'unittest', 'TestCase', 'WordCompileTest', '__name__', 'main') co_nlocals: 0 co_stacksize: 4 co_varnames: ('__doc__', 'unittest', 'TestCase', 'WordCompileTest', '__name__', 'main') co_code 64 01 00 5a 00 00 64 02 00 64 00 00 6c 01 00 5a 01 00 64 03 00 65 01 00 6a 02 00 66 01 00 64 04 00 84 00 00 83 00 00 59 5a 03 00 65 04 00 64 05 00 6b 02 00 72 44 00 65 01 00 6a 05 00 83 00 00 01 6e 00 00 64 00 00 53 disassembled: 6 0 LOAD_CONST 1 ('\nword_compile_test.py: Tests for word_compile.py\n') 3 STORE_NAME 0 (__doc__) 6 LOAD_CONST 2 (-1) 9 LOAD_CONST 0 (None) 12 IMPORT_NAME 1 (unittest) 15 STORE_NAME 1 (unittest) 11 18 LOAD_CONST 3 ('WordCompileTest') 21 LOAD_NAME 1 (unittest) 24 LOAD_ATTR 2 (TestCase) 27 BUILD_TUPLE 1 30 LOAD_CONST 4 (code object WordCompileTest osh/word_compile_test.py 11) 33 MAKE_FUNCTION 0 36 CALL_FUNCTION 0 39 BUILD_CLASS 40 STORE_NAME 3 (WordCompileTest) 15 43 LOAD_NAME 4 (__name__) 46 LOAD_CONST 5 ('__main__') 49 COMPARE_OP 2 (==) 52 POP_JUMP_IF_FALSE 68 16 55 LOAD_NAME 1 (unittest) 58 LOAD_ATTR 5 (main) 61 CALL_FUNCTION 0 64 POP_TOP 65 JUMP_FORWARD 0 (to 68) >> 68 LOAD_CONST 0 (None) 71 RETURN_VALUE co_consts 0 None 1 '\nword_compile_test.py: Tests for word_compile.py\n' 2 -1 3 'WordCompileTest' 4 (code object) co_argcount: 0 co_cellvars: () co_filename: 'osh/word_compile_test.py' co_firstlineno: 11 co_flags: 0x00002 CO_NEWLOCALS co_freevars: () co_lnotab: '\x06\x01' co_name: 'WordCompileTest' co_names: ('__name__', '__module__') co_nlocals: 0 co_stacksize: 2 co_varnames: () co_code 74 00 00 5a 01 00 52 53 disassembled: 11 0 LOAD_GLOBAL 0 (__name__) 3 STORE_NAME 1 (__module__) 12 6 LOAD_LOCALS 7 RETURN_VALUE co_consts 0 None 5 '__main__' OK dis COUNT 233 file_input stmt simple_stmt small_stmt expr_stmt testlist test or_test and_test not_test comparison expr xor_expr and_expr shift_expr arith_expr term factor power atom STRING """ word_compile_test.py: Tests for word_compile.py """ (2, 0) NEWLINE (4, 3) stmt simple_stmt small_stmt import_stmt import_name NAME import (6, 0) dotted_as_names dotted_as_name dotted_name NAME unittest (6, 7) NEWLINE (6, 15) stmt compound_stmt classdef NAME class (11, 0) NAME WordCompileTest (11, 6) LPAR ( (11, 21) testlist test or_test and_test not_test comparison expr xor_expr and_expr shift_expr arith_expr term factor power atom NAME unittest (11, 22) trailer DOT . (11, 30) NAME TestCase (11, 31) RPAR ) (11, 39) COLON : (11, 40) suite NEWLINE (11, 41) INDENT (12, 0) stmt simple_stmt small_stmt pass_stmt NAME pass (12, 2) NEWLINE (12, 6) DEDENT (15, 0) stmt compound_stmt if_stmt NAME if (15, 0) test or_test and_test not_test comparison expr xor_expr and_expr shift_expr arith_expr term factor power atom NAME __name__ (15, 3) comp_op EQEQUAL == (15, 12) expr xor_expr and_expr shift_expr arith_expr term factor power atom STRING '__main__' (15, 15) COLON : (15, 25) suite NEWLINE (15, 26) INDENT (16, 0) stmt simple_stmt small_stmt expr_stmt testlist test or_test and_test not_test comparison expr xor_expr and_expr shift_expr arith_expr term factor power atom NAME unittest (16, 2) trailer DOT . (16, 10) NAME main (16, 11) trailer LPAR ( (16, 15) RPAR ) (16, 16) NEWLINE (16, 17) DEDENT (17, 0) ENDMARKER (17, 0) OK parse a 0 atom - 0 assert_stmt a 0 single_input a 0 NAME a 1 ENDMARKER a = 3 0 atom - 0 assert_stmt a 0 single_input a 0 NAME a 1 EQUAL = 2 arglist 3 0 NUMBER 3 1 ENDMARKER unsigned int a 0 atom - 0 assert_stmt unsigned 0 NAME unsigned 1 NAME int 2 single_input a 0 NAME a 1 ENDMARKER unsigned unsigned int a 0 atom - 0 assert_stmt unsigned 0 NAME unsigned 1 NAME unsigned 2 NAME int 3 single_input a 0 NAME a 1 ENDMARKER unsigned unsigned b c 0 atom - 0 assert_stmt unsigned 0 NAME unsigned 1 NAME unsigned 2 single_input b 0 NAME b 3 single_input c 0 NAME c 1 ENDMARKER unsigned foo(arg); 0 arith_expr - 0 argument unsigned 0 augassign unsigned 0 NAME unsigned 1 single_input foo 0 NAME foo 2 LPAR ( 3 and_expr arg 0 NAME arg 4 RPAR ) 5 SEMI ; 1 ENDMARKER unsigned foo(arg) { body } 0 arith_expr - 0 argument unsigned 0 augassign unsigned 0 NAME unsigned 1 single_input foo 0 NAME foo 2 LPAR ( 3 and_expr arg 0 NAME arg 4 RPAR ) 5 LBRACE { 6 and_test body 0 NAME body 7 RBRACE } 1 ENDMARKER 1 + 2 0 single_input - 0 and_test 1 0 and_expr 1 0 NUMBER 1 1 PLUS + 2 and_expr 2 0 NUMBER 2 1 ENDMARKER a - 42 0 single_input - 0 and_test a 0 and_expr a 0 NAME a 1 MINUS - 2 and_expr 42 0 NUMBER 42 1 ENDMARKER if a - 42 0 single_input - 0 and_test if 0 NAME if 1 and_expr a 0 NAME a 2 MINUS - 3 and_expr 42 0 NUMBER 42 1 ENDMARKER DONE OK parse-with All test/opyc.sh tests passed.