Пример #1
0
 def test_del_noclose(self):
     r, w = os.pipe()
     s = SocketAdapter(w, close=False)
     s.sendall('x')
     del s
     os.close(w)
     self.assertEqual(FileObject(r).read(), 'x')
Пример #2
0
 def _test_del(self, **kwargs):
     r, w = os.pipe()
     s = SocketAdapter(w)
     s.sendall('x')
     del s
     try:
         os.close(w)
     except OSError:
         pass  # expected, because SocketAdapter already closed it
     else:
         raise AssertionError('os.close(%r) must not succeed' % w)
     self.assertEqual(FileObject(r).read(), 'x')