<s> from __future__ import print_function <EOL> import sys <EOL> from nose . tools import assert_equal , assert_true <EOL> from numpy . testing import assert_array_equal , assert_array_almost_equal <EOL> from cppproj import pybasics <EOL> def test_func4 ( ) : <EOL> exp = <NUM_LIT> <EOL> obs = pybasics . func4 ( <NUM_LIT> ) <EOL> assert_equal ( exp , obs ) <EOL> def test_person_id ( ) : <EOL> assert_equal ( pybasics . JOAN , <NUM_LIT:0> ) <EOL> assert_equal ( pybasics . HOOVER , <NUM_LIT:1> ) <EOL> assert_equal ( pybasics . MULAN , <NUM_LIT> ) <EOL> assert_equal ( pybasics . LESLIE , <NUM_LIT> ) <EOL> def test_three_nums ( ) : <EOL> x = pybasics . ThreeNums ( ) <EOL> x . a , x . b , x . c = <NUM_LIT:5> , <NUM_LIT:10> , <NUM_LIT:15> <EOL> assert_equal ( x . a , <NUM_LIT> ) <EOL> assert_equal ( x . b , <NUM_LIT> ) <EOL> assert_equal ( x . c , <NUM_LIT> ) <EOL> print ( "<STR_LIT>" , x . a , x . b , x . c ) <EOL> f = lambda a_ , b_ , c_ : a_ + b_ + c_ <EOL> print ( "<STR_LIT>" , sys . getrefcount ( f ) ) <EOL> x . op = f <EOL> print ( "<STR_LIT>" , sys . getrefcount ( f ) ) <EOL> print ( "<STR_LIT>" , x . op ) <EOL> x . _op = None <EOL> print ( "<STR_LIT>" , x . _op is None ) <EOL> print ( "<STR_LIT>" , sys . getrefcount ( f ) ) <EOL> print ( "<STR_LIT>" , x . op ) <EOL> v = x . op ( <NUM_LIT> , <NUM_LIT:16> , <NUM_LIT> ) <EOL> assert_equal ( <NUM_LIT> , v ) <EOL> print ( "<STR_LIT>" , v ) <EOL> v = pybasics . call_threenums_op_from_c ( x ) <EOL> assert_equal ( <NUM_LIT> , v ) <EOL> print ( "<STR_LIT>" , v ) <EOL> print ( "<STR_LIT:->" * <NUM_LIT> ) <EOL> x . op = lambda a_ , b_ , c_ : <NUM_LIT:2> * a_ + b_ ** <NUM_LIT:2> - c_ / <NUM_LIT> <EOL> print ( "<STR_LIT>" , x . op ) <EOL> print ( "<STR_LIT>" , sys . getrefcount ( f ) ) <EOL> v = x . op ( <NUM_LIT> , <NUM_LIT:16> , <NUM_LIT> ) <EOL> assert_equal ( <NUM_LIT> , v ) <EOL> print ( "<STR_LIT>" , v ) <EOL> v = pybasics . call_threenums_op_from_c ( x ) <EOL> assert_equal ( <NUM_LIT> , v ) <EOL> print ( "<STR_LIT>" , v ) <EOL> print ( "<STR_LIT:->" * <NUM_LIT> ) <EOL> y = pybasics . ThreeNums ( ) <EOL> y . a , y . b , y . c = <NUM_LIT:50> , <NUM_LIT:100> , <NUM_LIT> <EOL> x . op = lambda a_ , b_ , c_ : a_ + b_ + c_ <EOL> print ( "<STR_LIT>" , x . op ) <EOL> y . op = lambda a_ , b_ , c_ : <NUM_LIT:2> * a_ + b_ ** <NUM_LIT:2> - c_ / <NUM_LIT> <EOL> print ( "<STR_LIT>" , y . op ) <EOL> v = x . op ( <NUM_LIT> , <NUM_LIT:16> , <NUM_LIT> ) <EOL> assert_equal ( <NUM_LIT> , v ) <EOL> print ( "<STR_LIT>" , v ) <EOL> v = pybasics . call_threenums_op_from_c ( x ) <EOL> assert_equal ( <NUM_LIT> , v ) <EOL> print ( "<STR_LIT>" , v ) </s>
