MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_dealloc_warn

Method test_dealloc_warn

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

Source from the content-addressed store, hash-verified

1818 self.check_sendall_interrupted(True)
1819
1820 def test_dealloc_warn(self):
1821 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
1822 r = repr(sock)
1823 with self.assertWarns(ResourceWarning) as cm:
1824 sock = None
1825 support.gc_collect()
1826 self.assertIn(r, str(cm.warning.args[0]))
1827 # An open socket file object gets dereferenced after the socket
1828 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
1829 f = sock.makefile('rb')
1830 r = repr(sock)
1831 sock = None
1832 support.gc_collect()
1833 with self.assertWarns(ResourceWarning):
1834 f = None
1835 support.gc_collect()
1836
1837 def test_name_closed_socketio(self):
1838 with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected