diff --git a/__pycache__/test_hello.cpython-313.pyc b/__pycache__/test_hello.cpython-313.pyc new file mode 100644 index 0000000..d314afb Binary files /dev/null and b/__pycache__/test_hello.cpython-313.pyc differ diff --git a/test_hello.py b/test_hello.py new file mode 100644 index 0000000..a04d2ce --- /dev/null +++ b/test_hello.py @@ -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()