MCPcopy Create free account
hub / github.com/SplootCode/splootcode / testHelloWorld

Method testHelloWorld

python/tests/test_execute.py:10–36  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

8
9class ExecuteTest(unittest.TestCase):
10 def testHelloWorld(self):
11 splootFile = splootFromPython('print("Hello, World!")')
12
13 f = io.StringIO()
14 f.write = wrapStdout(f.write)
15 with contextlib.redirect_stdout(f):
16 cap, _ = executePythonFile(splootFile)
17
18 self.assertEqual(cap, {
19 'root': {
20 'type': 'PYTHON_FILE',
21 'data': {
22 'body': [
23 {
24 'type': 'PYTHON_EXPRESSION',
25 'data': {'result': 'None', 'resultType': 'NoneType'},
26 'sideEffects': [
27 {"type": "stdout", "value": 'Hello, World!'},
28 {"type": "stdout", "value": '\n'},
29 ]
30 }
31 ]
32 }
33 },
34 'detached': {}})
35
36 self.assertEqual(f.getvalue(), "Hello, World!\n")
37
38
39 def testIfElse(self):

Callers

nothing calls this directly

Calls 3

splootFromPythonFunction · 0.90
wrapStdoutFunction · 0.90
executePythonFileFunction · 0.90

Tested by

no test coverage detected