ó ükWc@spdZddlmZmZddlZddlZdejfd„ƒYZd„Ze dkrleƒndS(sDVerify that warnings are issued for global statements following use.i˙˙˙˙(t run_unittesttcheck_syntax_errorNt GlobalTestscBs,eZd„Zd„Zd„Zd„ZRS(cCsd}t||ƒdS(Ns<def wrong1(): a = 1 b = 2 global a global b (R(tselft prog_text_1((s&/usr/lib/python2.7/test/test_global.pyttest1 scCsd}t||ƒdS(Ns'def wrong2(): print x global x (R(Rt prog_text_2((s&/usr/lib/python2.7/test/test_global.pyttest2scCsd}t||ƒdS(Ns1def wrong3(): print x x = 2 global x (R(Rt prog_text_3((s&/usr/lib/python2.7/test/test_global.pyttest3scCsd}t|ddƒdS(Nsglobal x x = 2 s texec(tcompile(Rt prog_text_4((s&/usr/lib/python2.7/test/test_global.pyttest4%s(t__name__t __module__RRR R (((s&/usr/lib/python2.7/test/test_global.pyRs  cCs4tjƒ"tjdddƒttƒWdQXdS(Nterrortmodules (twarningstcatch_warningstfilterwarningsRR(((s&/usr/lib/python2.7/test/test_global.pyt test_main.s t__main__( t__doc__ttest.test_supportRRtunittestRtTestCaseRRR(((s&/usr/lib/python2.7/test/test_global.pyts  &