(self)
| 403 | ) |
| 404 | |
| 405 | def testHereDoc(self): |
| 406 | text = """\ |
| 407 | <main> |
| 408 | PYTHON <<MYPYTHON |
| 409 | def a(): |
| 410 | x = y |
| 411 | return |
| 412 | MYPYTHON |
| 413 | </main> |
| 414 | """ |
| 415 | ast = self._make_parser().parse(text) |
| 416 | |
| 417 | self.assertEqual( |
| 418 | ast, [ |
| 419 | 'contents', ['block', ('main',), [ |
| 420 | 'contents', [ |
| 421 | 'statement', 'PYTHON', ' def a():\n ' |
| 422 | 'x = y\n return' |
| 423 | ] |
| 424 | ], 'main'] |
| 425 | ] |
| 426 | ) |
| 427 | |
| 428 | def testHereDocEscapedNewlinePreservesWhitespace(self): |
| 429 | text = """\ |
nothing calls this directly
no test coverage detected