<s> from pypy . conftest import gettestobjspace <EOL> def setup_module ( mod ) : <EOL> mod . space = gettestobjspace ( usemodules = [ "<STR_LIT>" ] ) <EOL> class ParserModuleTest : <EOL> def setup_class ( cls ) : <EOL> cls . space = space <EOL> cls . w_m = space . appexec ( [ ] , """<STR_LIT>""" ) <EOL> class AppTestParser ( ParserModuleTest ) : <EOL> def test_suite ( self ) : <EOL> s = self . m . suite ( "<STR_LIT>" ) <EOL> assert isinstance ( s , self . m . STType ) <EOL> assert self . m . issuite ( s ) <EOL> assert s . issuite ( ) <EOL> assert not self . m . isexpr ( s ) <EOL> assert not s . isexpr ( ) <EOL> def test_expr ( self ) : <EOL> s = self . m . expr ( "<STR_LIT:x>" ) <EOL> assert isinstance ( s , self . m . STType ) <EOL> assert self . m . isexpr ( s ) <EOL> assert s . isexpr ( ) <EOL> assert not self . m . issuite ( s ) <EOL> assert not s . issuite ( ) <EOL> def test_totuple_and_tolist ( self ) : <EOL> for meth , tp in ( ( "<STR_LIT>" , tuple ) , ( "<STR_LIT>" , list ) ) : <EOL> s = self . m . suite ( "<STR_LIT>" ) <EOL> seq = getattr ( s , meth ) ( ) <EOL> assert isinstance ( seq , tp ) <EOL> assert len ( seq ) == <NUM_LIT:4> <EOL> assert seq [ <NUM_LIT:0> ] == <NUM_LIT> <EOL> assert len ( seq [ <NUM_LIT:2> ] ) == <NUM_LIT:2> <EOL> assert len ( seq [ <NUM_LIT:3> ] ) == <NUM_LIT:2> <EOL> assert seq [ <NUM_LIT:2> ] [ <NUM_LIT:0> ] == <NUM_LIT:4> <EOL> assert seq [ <NUM_LIT:3> ] [ <NUM_LIT:0> ] == <NUM_LIT:0> <EOL> seq = getattr ( s , meth ) ( True ) <EOL> assert len ( seq [ <NUM_LIT:2> ] ) == <NUM_LIT:3> <EOL> assert seq [ <NUM_LIT:2> ] [ <NUM_LIT:2> ] == <NUM_LIT:1> <EOL> seq = getattr ( s , meth ) ( True , True ) <EOL> assert len ( seq [ <NUM_LIT:2> ] ) == <NUM_LIT:4> <EOL> assert seq [ <NUM_LIT:2> ] [ <NUM_LIT:2> ] == <NUM_LIT:1> <EOL> assert seq [ <NUM_LIT:2> ] [ <NUM_LIT:3> ] == <NUM_LIT:0> <EOL> def test_compile ( self ) : <EOL> import types <EOL> for code in ( self . m . suite ( "<STR_LIT>" ) . compile ( ) , <EOL> self . m . compilest ( self . m . suite ( "<STR_LIT>" ) ) ) : <EOL> assert isinstance ( code , types . CodeType ) <EOL> assert code . co_filename == "<STR_LIT>" </s>
