mirror of
https://github.com/python/cpython.git
synced 2025-11-10 18:42:04 +00:00
Add compiler test regarding optional arguments.
This commit is contained in:
parent
74ef694da0
commit
39cdfff691
1 changed files with 4 additions and 1 deletions
|
|
@ -12,7 +12,6 @@ def testCompileLibrary(self):
|
||||||
# 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__)
|
||||||
|
|
||||||
|
|
@ -37,6 +36,10 @@ def testCompileLibrary(self):
|
||||||
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.
|
||||||
filename = __file__
|
filename = __file__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue