Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 39cdfff

Browse files
committed
Add compiler test regarding optional arguments.
1 parent 74ef694 commit 39cdfff

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Lib/test/test_compiler.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ def testCompileLibrary(self):
1212
# standard library and its test suite. This doesn't verify
1313
# that any of the code is correct, merely the compiler is able
1414
# to generate some kind of code for it.
15-
1615
libdir = os.path.dirname(unittest.__file__)
1716
testdir = os.path.dirname(test.test_support.__file__)
1817

@@ -36,6 +35,10 @@ def testCompileLibrary(self):
3635

3736
def testNewClassSyntax(self):
3837
compiler.compile("class foo():pass\n\n","<string>","exec")
38+
39+
def testSyntaxErrors(self):
40+
self.assertRaises(SyntaxError, compiler.compile,
41+
"def foo(a=1,b):pass\n\n", "<string>", "exec")
3942

4043
def testLineNo(self):
4144
# Test that all nodes except Module have a correct lineno attribute.

0 commit comments

Comments
 (0)