Kaydet (Commit) 39cdfff6 authored tarafından Georg Brandl's avatar Georg Brandl

Add compiler test regarding optional arguments.

üst 74ef694d
...@@ -12,7 +12,6 @@ class CompilerTest(unittest.TestCase): ...@@ -12,7 +12,6 @@ class CompilerTest(unittest.TestCase):
# standard library and its test suite. This doesn't verify # standard library and its test suite. This doesn't verify
# that any of the code is correct, merely the compiler is able # that any of the code is correct, merely the compiler is able
# to generate some kind of code for it. # to generate some kind of code for it.
libdir = os.path.dirname(unittest.__file__) libdir = os.path.dirname(unittest.__file__)
testdir = os.path.dirname(test.test_support.__file__) testdir = os.path.dirname(test.test_support.__file__)
...@@ -36,6 +35,10 @@ class CompilerTest(unittest.TestCase): ...@@ -36,6 +35,10 @@ class CompilerTest(unittest.TestCase):
def testNewClassSyntax(self): def testNewClassSyntax(self):
compiler.compile("class foo():pass\n\n","<string>","exec") compiler.compile("class foo():pass\n\n","<string>","exec")
def testSyntaxErrors(self):
self.assertRaises(SyntaxError, compiler.compile,
"def foo(a=1,b):pass\n\n", "<string>", "exec")
def testLineNo(self): def testLineNo(self):
# Test that all nodes except Module have a correct lineno attribute. # Test that all nodes except Module have a correct lineno attribute.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment