Write a simple python hello world #5

Open
coding-agent wants to merge 5 commits from agent-pr/write-a-simple-python-hello-wo into main
2 changed files with 29 additions and 0 deletions
Showing only changes of commit c154f04084 - Show all commits
Binary file not shown.
+29
View File
@@ -0,0 +1,29 @@
import subprocess
import unittest
class TestHello(unittest.TestCase):
def test_hello_output(self):
"""Test that hello.py prints 'Hello, World!' to stdout."""
result = subprocess.run(
["python3", "hello.py"],
capture_output=True,
text=True,
cwd="/workspace"
)
self.assertEqual(result.returncode, 0)
self.assertIn("Hello, World!", result.stdout)
def test_hello_no_stderr(self):
"""Test that hello.py produces no stderr output."""
result = subprocess.run(
["python3", "hello.py"],
capture_output=True,
text=True,
cwd="/workspace"
)
self.assertEqual(result.stderr, "")
if __name__ == "__main__":
unittest.main()