Mercurial > pytave
changeset 60:bb7c52547fcf pytave-tests
Improved tests
author | David Grundberg <individ@acc.umu.se> |
---|---|
date | Mon, 08 Jun 2009 20:51:11 +0200 |
parents | f379cb14c4d4 |
children | 8135e840ef0e |
files | test/test.py |
diffstat | 1 files changed, 28 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/test/test.py Mon Jun 08 15:35:08 2009 +0200 +++ b/test/test.py Mon Jun 08 20:51:11 2009 +0200 @@ -252,7 +252,9 @@ testparseerror(1, "endfunction") testevalexpect(1, "2 + 2", (4,)) testevalexpect(1, "{2}", ([2],)) -testevalexpect(2, "struct('foo', 2)", ({'foo': 2},)) + +# FIXME +testevalexpect(1, "struct('foo', 2)", ({'foo': 2},)) testsetget(pytave.locals, "xxx", [1,2,3]) testsetget(pytave.globals, "xxx", [1,2,3]) @@ -279,6 +281,31 @@ testlocalscope(5) +testexception(KeyError, lambda: pytave.locals["localvariable"]) +pytave.locals["localvariable"] = 1 +if "localvariable" in pytave.globals: + fail("Local variable in globals") +del pytave.locals["localvariable"] +if "localvariable" in pytave.locals: + fail("Could not clear local variable") +testexception(KeyError, lambda: pytave.locals["localvariable"]) +def func(): + del pytave.locals["localvariable"] +testexception(KeyError, lambda: func()) + +testexception(KeyError, lambda: pytave.globals["globalvariable"]) +pytave.globals["globalvariable"] = 1 +if "globalvariable" in pytave.locals: + fail("Global variable in locals") +del pytave.globals["globalvariable"] +if "globalvariable" in pytave.globals: + fail("Could not clear global variable") +testexception(KeyError, lambda: pytave.globals["globalvariable"]) +def func(): + del pytave.globals["globalvariable"] +testexception(KeyError, lambda: func()) + + # Emacs # Local Variables: # fill-column:70