MCPcopy Index your code
hub / github.com/python/cpython / test_dealloc_warn

Method test_dealloc_warn

Lib/test/test_socket.py:1871–1886  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1869 self.check_sendall_interrupted(True)
1870
1871 def test_dealloc_warn(self):
1872 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
1873 r = repr(sock)
1874 with self.assertWarns(ResourceWarning) as cm:
1875 sock = None
1876 support.gc_collect()
1877 self.assertIn(r, str(cm.warning.args[0]))
1878 # An open socket file object gets dereferenced after the socket
1879 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
1880 f = sock.makefile('rb')
1881 r = repr(sock)
1882 sock = None
1883 support.gc_collect()
1884 with self.assertWarns(ResourceWarning):
1885 f = None
1886 support.gc_collect()
1887
1888 def test_name_closed_socketio(self):
1889 with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:

Callers

nothing calls this directly

Calls 5

strFunction · 0.85
socketMethod · 0.80
assertWarnsMethod · 0.80
assertInMethod · 0.80
makefileMethod · 0.45

Tested by

no test coverage detected