summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_popen.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_popen.py b/Lib/test/test_popen.py
index 99ad41d..24fb846 100644
--- a/Lib/test/test_popen.py
+++ b/Lib/test/test_popen.py
@@ -49,6 +49,14 @@ class PopenTest(unittest.TestCase):
else:
self.assertEqual(os.popen("exit 42").close(), 42 << 8)
+ def test_contextmanager(self):
+ with os.popen("echo hello") as f:
+ self.assertEqual(f.read(), "hello\n")
+
+ def test_iterating(self):
+ with os.popen("echo hello") as f:
+ self.assertEqual(list(f), ["hello\n"])
+
def test_main():
support.run_unittest(PopenTest)