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

Method test_repr

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

Source from the content-addressed store, hash-verified

926 s.close()
927
928 def test_repr(self):
929 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
930 with s:
931 self.assertIn('fd=%i' % s.fileno(), repr(s))
932 self.assertIn('family=%s' % socket.AF_INET, repr(s))
933 self.assertIn('type=%s' % socket.SOCK_STREAM, repr(s))
934 self.assertIn('proto=0', repr(s))
935 self.assertNotIn('raddr', repr(s))
936 s.bind(('127.0.0.1', 0))
937 self.assertIn('laddr', repr(s))
938 self.assertIn(str(s.getsockname()), repr(s))
939 self.assertIn('[closed]', repr(s))
940 self.assertNotIn('laddr', repr(s))
941
942 @unittest.skipUnless(_socket is not None, 'need _socket module')
943 def test_csocket_repr(self):

Callers

nothing calls this directly

Calls 8

reprFunction · 0.85
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