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

Method test_repr

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

Source from the content-addressed store, hash-verified

936 s.close()
937
938 def test_repr(self):
939 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
940 with s:
941 self.assertIn('fd=%i' % s.fileno(), repr(s))
942 self.assertIn('family=%s' % socket.AF_INET, repr(s))
943 self.assertIn('type=%s' % socket.SOCK_STREAM, repr(s))
944 self.assertIn('proto=0', repr(s))
945 self.assertNotIn('raddr', repr(s))
946 s.bind(('127.0.0.1', 0))
947 self.assertIn('laddr', repr(s))
948 self.assertIn(str(s.getsockname()), repr(s))
949 self.assertIn('[closed]', repr(s))
950 self.assertNotIn('laddr', repr(s))
951
952 @unittest.skipUnless(_socket is not None, 'need _socket module')
953 def test_csocket_repr(self):

Callers

nothing calls this directly

Calls 7

strFunction · 0.85
socketMethod · 0.80
assertInMethod · 0.80
assertNotInMethod · 0.80
filenoMethod · 0.45
bindMethod · 0.45
getsocknameMethod · 0.45

Tested by

no test coverage detected