diff options
Diffstat (limited to 'test/functional/globals.py')
-rw-r--r-- | test/functional/globals.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/functional/globals.py b/test/functional/globals.py new file mode 100644 index 0000000..04bfd95 --- /dev/null +++ b/test/functional/globals.py @@ -0,0 +1,24 @@ +"""Warnings about global statements and usage of global variables.""" + +global CSTE # [global-at-module-level] +print CSTE # [undefined-variable] + +CONSTANT = 1 + +def fix_contant(value): + """all this is ok, but try not using global ;)""" + global CONSTANT # [global-statement] + print CONSTANT + CONSTANT = value + + +def other(): + """global behaviour test""" + global HOP # [global-variable-not-assigned] + print HOP # [undefined-variable] + + +def define_constant(): + """ok but somevar is not defined at the module scope""" + global SOMEVAR # [global-variable-undefined] + SOMEVAR = 2 |