<s> from pypy . conftest import gettestobjspace <EOL> class AppTest_Taint : <EOL> def setup_class ( cls ) : <EOL> cls . space = gettestobjspace ( '<STR_LIT>' ) <EOL> def test_simple ( self ) : <EOL> from __pypy__ import taint , untaint , TaintError <EOL> x = taint ( <NUM_LIT:6> ) <EOL> x = x * <NUM_LIT:7> <EOL> raises ( TaintError , "<STR_LIT>" ) <EOL> t = type ( x ) <EOL> raises ( TaintError , "<STR_LIT>" ) <EOL> assert untaint ( int , x ) == <NUM_LIT> <EOL> raises ( TaintError , "<STR_LIT>" ) <EOL> def test_bomb ( self ) : <EOL> from __pypy__ import taint , untaint , TaintError <EOL> x = taint ( <NUM_LIT:6> ) <EOL> x = x / <NUM_LIT:0> <EOL> raises ( TaintError , "<STR_LIT>" ) <EOL> t = type ( x ) <EOL> raises ( TaintError , "<STR_LIT>" ) <EOL> raises ( TaintError , "<STR_LIT>" ) <EOL> raises ( TaintError , "<STR_LIT>" ) <EOL> def test_taint_atomic ( self ) : <EOL> from __pypy__ import taint , untaint , TaintError , taint_atomic <EOL> x = taint ( <NUM_LIT:6> ) <EOL> x *= <NUM_LIT:7> <EOL> def dummy ( x ) : <EOL> if x > <NUM_LIT> : <EOL> return <NUM_LIT:5> <EOL> else : <EOL> return <NUM_LIT:3> <EOL> dummy = taint_atomic ( dummy ) <EOL> y = dummy ( x ) <EOL> raises ( TaintError , "<STR_LIT>" ) <EOL> assert untaint ( int , y ) == <NUM_LIT:5> <EOL> def test_taint_atomic_exception ( self ) : <EOL> from __pypy__ import taint , untaint , TaintError , taint_atomic <EOL> x = taint ( <NUM_LIT:6> ) <EOL> x *= <NUM_LIT:7> <EOL> def dummy ( x ) : <EOL> if x + "<STR_LIT>" == "<STR_LIT>" : <EOL> return <NUM_LIT:5> <EOL> else : <EOL> return <NUM_LIT:3> <EOL> dummy = taint_atomic ( dummy ) <EOL> y = dummy ( x ) <EOL> raises ( TaintError , "<STR_LIT>" ) <EOL> raises ( TaintError , "<STR_LIT>" ) <EOL> def test_taint_atomic_incoming_bomb ( self ) : <EOL> from __pypy__ import taint , untaint , TaintError , taint_atomic <EOL> x = taint ( <NUM_LIT:6> ) <EOL> x /= <NUM_LIT:0> <EOL> lst = [ ] <EOL> def dummy ( x ) : <EOL> lst . append ( "<STR_LIT>" ) <EOL> if x > <NUM_LIT> : <EOL> return <NUM_LIT:5> <EOL> else : <EOL> return <NUM_LIT:3> <EOL> dummy = taint_atomic ( dummy ) <EOL> y = dummy ( x ) <EOL> raises ( TaintError , "<STR_LIT>" ) <EOL> assert lst == [ ] <EOL> raises ( TaintError , "<STR_LIT>" ) </s>
