<s> from pypy . rpython . rtyper import RPythonTyper <EOL> from pypy . annotation import model as annmodel <EOL> from pypy . annotation . annrpython import RPythonAnnotator <EOL> from pypy . annotation import policy <EOL> from pypy . rpython . test . test_llinterp import interpret , interpret_raises <EOL> import py <EOL> from pypy . rpython . test . tool import LLRtypeMixin , OORtypeMixin <EOL> class BaseRGenericTest : <EOL> def test_some_generic_function_call ( self ) : <EOL> def h ( x ) : <EOL> return int ( x ) <EOL> def c ( x ) : <EOL> return int ( x ) + <NUM_LIT:1> <EOL> def default ( x ) : <EOL> return int ( x ) + <NUM_LIT:3> <EOL> def g ( a , x ) : <EOL> if x == - <NUM_LIT:1> : <EOL> a = None <EOL> if x > <NUM_LIT:0> : <EOL> if x == <NUM_LIT:1> : <EOL> a = h <EOL> else : <EOL> a = c <EOL> x = x + <NUM_LIT> <EOL> return a ( x ) <EOL> def f ( x ) : <EOL> return g ( default , x ) <EOL> g . _annenforceargs_ = policy . Sig ( annmodel . SomeGenericCallable ( <EOL> args = [ annmodel . SomeFloat ( ) ] , result = annmodel . SomeInteger ( ) ) , <EOL> float ) <EOL> assert interpret ( f , [ <NUM_LIT:1.> ] ) == <NUM_LIT:1> <EOL> assert interpret ( f , [ <NUM_LIT> ] ) == <NUM_LIT:11> <EOL> assert interpret ( f , [ - <NUM_LIT> ] ) == <NUM_LIT:0> <EOL> class TestLLRgeneric ( BaseRGenericTest , LLRtypeMixin ) : <EOL> pass <EOL> class TestOORgeneric ( BaseRGenericTest , OORtypeMixin ) : <EOL> pass </s>
