File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -57,14 +57,21 @@ def test_return_code(self):
5757 def test_contextmanager (self ):
5858 with os .popen ("echo hello" ) as f :
5959 self .assertEqual (f .read (), "hello\n " )
60+ self .assertFalse (f .closed )
61+ self .assertTrue (f .closed )
6062
6163 def test_iterating (self ):
6264 with os .popen ("echo hello" ) as f :
6365 self .assertEqual (list (f ), ["hello\n " ])
66+ self .assertFalse (f .closed )
67+ self .assertTrue (f .closed )
6468
6569 def test_keywords (self ):
66- with os .popen (cmd = "exit 0" , mode = "w" , buffering = - 1 ):
67- pass
70+ with os .popen (cmd = "echo hello" , mode = "r" , buffering = - 1 ) as f :
71+ self .assertEqual (f .read (), "hello\n " )
72+ self .assertFalse (f .closed )
73+ self .assertTrue (f .closed )
74+
6875
6976if __name__ == "__main__" :
7077 unittest .main ()
You can’t perform that action at this time.
0 commit comments