Back to index

python3.2  3.2.2
Public Member Functions
test.test_parser.CompileTestCase Class Reference

List of all members.

Public Member Functions

def test_compile_expr
def test_compile_suite
def test_compile_error
def test_compile_badunicode
def test_issue_9011

Detailed Description

Definition at line 494 of file test_parser.py.


Member Function Documentation

Definition at line 514 of file test_parser.py.

00514 
00515     def test_compile_badunicode(self):
00516         st = parser.suite('a = "\\U12345678"')
00517         self.assertRaises(SyntaxError, parser.compilest, st)
00518         st = parser.suite('a = "\\u1"')
00519         self.assertRaises(SyntaxError, parser.compilest, st)

Here is the call graph for this function:

Definition at line 510 of file test_parser.py.

00510 
00511     def test_compile_error(self):
00512         st = parser.suite('1 = 3 + 4')
00513         self.assertRaises(SyntaxError, parser.compilest, st)

Here is the call graph for this function:

Definition at line 498 of file test_parser.py.

00498 
00499     def test_compile_expr(self):
00500         st = parser.expr('2 + 3')
00501         code = parser.compilest(st)
00502         self.assertEqual(eval(code), 5)

Here is the call graph for this function:

Definition at line 503 of file test_parser.py.

00503 
00504     def test_compile_suite(self):
00505         st = parser.suite('x = 2; y = x + 3')
00506         code = parser.compilest(st)
00507         globs = {}
00508         exec(code, globs)
00509         self.assertEqual(globs['y'], 5)

Here is the call graph for this function:

Definition at line 520 of file test_parser.py.

00520 
00521     def test_issue_9011(self):
00522         # Issue 9011: compilation of an unary minus expression changed
00523         # the meaning of the ST, so that a second compilation produced
00524         # incorrect results.
00525         st = parser.expr('-3')
00526         code1 = parser.compilest(st)
00527         self.assertEqual(eval(code1), -3)
00528         code2 = parser.compilest(st)
00529         self.assertEqual(eval(code2), -3)

Here is the call graph for this function:


The documentation for this class was generated from the following file: