(self)
| 37 | |
| 38 | |
| 39 | def testIfElse(self): |
| 40 | self.maxDiff = None |
| 41 | splootFile = splootFromPython(''' |
| 42 | x = 10 |
| 43 | if x == 10: |
| 44 | print('hi') |
| 45 | else: |
| 46 | print('bye') |
| 47 | ''') |
| 48 | |
| 49 | f = io.StringIO() |
| 50 | f.write = wrapStdout(f.write) |
| 51 | with contextlib.redirect_stdout(f): |
| 52 | cap, _ = executePythonFile(splootFile) |
| 53 | |
| 54 | self.assertEqual(cap, { |
| 55 | 'root': { |
| 56 | 'type': 'PYTHON_FILE', |
| 57 | 'data': { |
| 58 | 'body': [ |
| 59 | {'type': 'PYTHON_ASSIGNMENT', 'data': {'result': '10', 'resultType': 'int'}}, |
| 60 | {'type': 'PYTHON_IF_STATEMENT', 'data': { |
| 61 | 'condition': [{'data': {'result': 'True', 'resultType': 'bool'}}], |
| 62 | 'trueblock': [{ |
| 63 | 'type': 'PYTHON_EXPRESSION', |
| 64 | 'data': {'result': 'None', 'resultType': 'NoneType'}, |
| 65 | 'sideEffects': [{'type': 'stdout', 'value':'hi'},{'type': 'stdout', 'value':'\n'}] |
| 66 | }] |
| 67 | }}, |
| 68 | ] |
| 69 | } |
| 70 | }, |
| 71 | 'detached': {}}) |
| 72 | |
| 73 | def testElse(self): |
| 74 | self.maxDiff = None |
nothing calls this directly
no test coverage detected