[pypy-svn] r63756 - pypy/branch/classdeco/pypy/interpreter/test
benjamin at codespeak.net
benjamin at codespeak.net
Tue Apr 7 00:12:36 CEST 2009
Author: benjamin
Date: Tue Apr 7 00:12:34 2009
New Revision: 63756
Modified:
pypy/branch/classdeco/pypy/interpreter/test/test_syntax.py
Log:
more tests
Modified: pypy/branch/classdeco/pypy/interpreter/test/test_syntax.py
==============================================================================
--- pypy/branch/classdeco/pypy/interpreter/test/test_syntax.py (original)
+++ pypy/branch/classdeco/pypy/interpreter/test/test_syntax.py Tue Apr 7 00:12:34 2009
@@ -608,6 +608,20 @@
exec prog in ns
assert ns["record"] == ["one", "two"]
+ def test_call(self):
+ prog = """def dec(arg):
+ assert arg == 1
+ def x(cls):
+ cls.testing = True
+ return cls
+ return x
+ at dec(1)
+class my_class: pass
+"""
+ ns = {}
+ exec prog in ns
+ assert ns["my_class"].testing
+
def test_attribute(self):
prog = """def my_deco(cls):
cls.testing = True
@@ -622,6 +636,25 @@
exec prog in ns
assert ns["myclass"].testing
+ def test_invalidness(self):
+ def check(source):
+ try:
+ exec source in {}
+ except SyntaxError:
+ pass
+ else:
+ assert False, "invalid syntax didn't raise"
+
+ prog = """@2
+class my_class: pass
+"""
+ check(prog)
+
+ prog = """@{'hi' : 3}
+class my_class: pass
+"""
+ check(prog)
+
class AppTestSyntaxError:
More information about the Pypy-commit
mailing list