diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-04-13 13:48:48 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-04-13 13:48:48 -0400 |
| commit | 10c0aae0e06832d7a1684063246568dc93217b7a (patch) | |
| tree | a73ba37e9f28d7121b1d08cb793d56552584a6de /test/test_ast.py | |
| parent | 73be27022328eb60f719431fd70a63f1265cf473 (diff) | |
| parent | c2373cede978a62eb3c142c5ca4bb1a02a32b3ad (diff) | |
| download | external_python_mako-10c0aae0e06832d7a1684063246568dc93217b7a.tar.gz external_python_mako-10c0aae0e06832d7a1684063246568dc93217b7a.tar.bz2 external_python_mako-10c0aae0e06832d7a1684063246568dc93217b7a.zip | |
Merge branch 'master' into w_json_metadata
Conflicts:
doc/build/changelog.rst
Diffstat (limited to 'test/test_ast.py')
| -rw-r--r-- | test/test_ast.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/test/test_ast.py b/test/test_ast.py index 9f9ec10..32a1d74 100644 --- a/test/test_ast.py +++ b/test/test_ast.py @@ -1,7 +1,8 @@ import unittest from mako import ast, exceptions, pyparser, util, compat -from test import eq_, requires_python_2, requires_python_3 +from test import eq_, requires_python_2, requires_python_3, \ + requires_python_26_or_greater exception_kwargs = { 'source': '', @@ -222,6 +223,28 @@ t2 = lambda (x,y):(x+5, y+4) eq_(parsed.declared_identifiers, set(['t1', 't2'])) eq_(parsed.undeclared_identifiers, set()) + @requires_python_26_or_greater + def test_locate_identifiers_16(self): + code = """ +try: + print(x) +except Exception as e: + print(y) +""" + parsed = ast.PythonCode(code, **exception_kwargs) + eq_(parsed.undeclared_identifiers, set(['x', 'y', 'Exception'])) + + @requires_python_26_or_greater + def test_locate_identifiers_17(self): + code = """ +try: + print(x) +except (Foo, Bar) as e: + print(y) +""" + parsed = ast.PythonCode(code, **exception_kwargs) + eq_(parsed.undeclared_identifiers, set(['x', 'y', 'Foo', 'Bar'])) + def test_no_global_imports(self): code = """ from foo import * |
