ó
wŰjc           @   sp   d  Z  d d l m Z m Z d d l Z d d l Z d e j f d     YZ d   Z e	 d k rl e   n  d S(   sD   Verify that warnings are issued for global statements following use.i˙˙˙˙(   t   run_unittestt   check_syntax_errorNt   GlobalTestsc           B   s,   e  Z d    Z d   Z d   Z d   Z RS(   c         C   s   d } t  |  |  d  S(   Ns<   def wrong1():
    a = 1
    b = 2
    global a
    global b
(   R   (   t   selft   prog_text_1(    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_global.pyt   test1
   s    c         C   s   d } t  |  |  d  S(   Ns'   def wrong2():
    print x
    global x
(   R   (   R   t   prog_text_2(    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_global.pyt   test2   s    c         C   s   d } t  |  |  d  S(   Ns1   def wrong3():
    print x
    x = 2
    global x
(   R   (   R   t   prog_text_3(    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_global.pyt   test3   s    c         C   s   d } t  | d d  d  S(   Ns   global x
x = 2
s   <test string>t   exec(   t   compile(   R   t   prog_text_4(    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_global.pyt   test4%   s    (   t   __name__t
   __module__R   R   R	   R   (    (    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_global.pyR      s   	
			c           C   s4   t  j   " t  j d d d t t  Wd  QXd  S(   Nt   errort   modules   <test string>(   t   warningst   catch_warningst   filterwarningsR    R   (    (    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_global.pyt	   test_main.   s    t   __main__(
   t   __doc__t   test.test_supportR    R   t   unittestR   t   TestCaseR   R   R   (    (    (    s   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_global.pyt   <module>   s   &	