(self)
| 71 | 'detached': {}}) |
| 72 | |
| 73 | def testElse(self): |
| 74 | self.maxDiff = None |
| 75 | splootFile = splootFromPython(''' |
| 76 | x = 10 |
| 77 | if x != 10: |
| 78 | print('hi') |
| 79 | else: |
| 80 | print('bye') |
| 81 | ''') |
| 82 | |
| 83 | f = io.StringIO() |
| 84 | f.write = wrapStdout(f.write) |
| 85 | with contextlib.redirect_stdout(f): |
| 86 | cap, _ = executePythonFile(splootFile) |
| 87 | |
| 88 | self.assertEqual(cap, { |
| 89 | 'root': { |
| 90 | 'type': 'PYTHON_FILE', |
| 91 | 'data': { |
| 92 | 'body': [ |
| 93 | {'type': 'PYTHON_ASSIGNMENT', 'data': {'result': '10', 'resultType': 'int'}}, |
| 94 | { |
| 95 | 'type': 'PYTHON_IF_STATEMENT', |
| 96 | 'data': { |
| 97 | 'condition': [{'data': {'result': 'False', 'resultType': 'bool'}}], |
| 98 | 'elseblocks': [{ |
| 99 | 'type': 'PYTHON_ELSE_STATEMENT', |
| 100 | 'data': { |
| 101 | 'block': [ |
| 102 | {'type': 'PYTHON_EXPRESSION', |
| 103 | 'data': {'result': 'None', 'resultType': 'NoneType'}, |
| 104 | 'sideEffects': [{'type': 'stdout', 'value':'bye'},{'type': 'stdout', 'value':'\n'}]} |
| 105 | ] |
| 106 | }} |
| 107 | ]} |
| 108 | }, |
| 109 | ] |
| 110 | } |
| 111 | }, |
| 112 | 'detached': {}}) |
| 113 | |
| 114 | |
| 115 | def testFunctionDeclaration(self): |
nothing calls this directly
no test coverage detected