<s> """<STR_LIT>""" <EOL> import re <EOL> from jinja2 . runtime import Undefined <EOL> __test__ = False <EOL> number_re = re . compile ( r'<STR_LIT>' ) <EOL> regex_type = type ( number_re ) <EOL> try : <EOL> test_callable = callable <EOL> except NameError : <EOL> def test_callable ( x ) : <EOL> return hasattr ( x , '<STR_LIT>' ) <EOL> def test_odd ( value ) : <EOL> """<STR_LIT>""" <EOL> return value % <NUM_LIT:2> == <NUM_LIT:1> <EOL> def test_even ( value ) : <EOL> """<STR_LIT>""" <EOL> return value % <NUM_LIT:2> == <NUM_LIT:0> <EOL> def test_divisibleby ( value , num ) : <EOL> """<STR_LIT>""" <EOL> return value % num == <NUM_LIT:0> <EOL> def test_defined ( value ) : <EOL> """<STR_LIT>""" <EOL> return not isinstance ( value , Undefined ) <EOL> def test_undefined ( value ) : <EOL> """<STR_LIT>""" <EOL> return isinstance ( value , Undefined ) <EOL> def test_none ( value ) : <EOL> """<STR_LIT>""" <EOL> return value is None <EOL> def test_lower ( value ) : <EOL> """<STR_LIT>""" <EOL> return unicode ( value ) . islower ( ) <EOL> def test_upper ( value ) : <EOL> """<STR_LIT>""" <EOL> return unicode ( value ) . isupper ( ) <EOL> def test_string ( value ) : <EOL> """<STR_LIT>""" <EOL> return isinstance ( value , basestring ) <EOL> def test_number ( value ) : <EOL> """<STR_LIT>""" <EOL> return isinstance ( value , ( int , long , float , complex ) ) <EOL> def test_sequence ( value ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> len ( value ) <EOL> value . __getitem__ <EOL> except : <EOL> return False <EOL> return True <EOL> def test_sameas ( value , other ) : <EOL> """<STR_LIT>""" <EOL> return value is other <EOL> def test_iterable ( value ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> iter ( value ) <EOL> except TypeError : <EOL> return False <EOL> return True <EOL> def test_escaped ( value ) : <EOL> """<STR_LIT>""" <EOL> return hasattr ( value , '<STR_LIT>' ) <EOL> TESTS = { <EOL> '<STR_LIT>' : test_odd , <EOL> '<STR_LIT>' : test_even , <EOL> '<STR_LIT>' : test_divisibleby , <EOL> '<STR_LIT>' : test_defined , <EOL> '<STR_LIT>' : test_undefined , <EOL> '<STR_LIT:none>' : test_none , <EOL> '<STR_LIT>' : test_lower , <EOL> '<STR_LIT>' : test_upper , <EOL> '<STR_LIT:string>' : test_string , <EOL> '<STR_LIT>' : test_number , <EOL> '<STR_LIT>' : test_sequence , <EOL> '<STR_LIT>' : test_iterable , <EOL> '<STR_LIT>' : test_callable , <EOL> '<STR_LIT>' : test_sameas , <EOL> '<STR_LIT>' : test_escaped <EOL> } </s>
