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

Method test_errors

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

Source from the content-addressed store, hash-verified

7049 pass
7050
7051 def test_errors(self):
7052 with open(os_helper.TESTFN, 'rb') as file:
7053 with socket.socket(type=socket.SOCK_DGRAM) as s:
7054 meth = self.meth_from_sock(s)
7055 self.assertRaisesRegex(
7056 ValueError, "SOCK_STREAM", meth, file)
7057 with open(os_helper.TESTFN, encoding="utf-8") as file:
7058 with socket.socket() as s:
7059 meth = self.meth_from_sock(s)
7060 self.assertRaisesRegex(
7061 ValueError, "binary mode", meth, file)
7062 with open(os_helper.TESTFN, 'rb') as file:
7063 with socket.socket() as s:
7064 meth = self.meth_from_sock(s)
7065 self.assertRaisesRegex(TypeError, "positive integer",
7066 meth, file, count='2')
7067 self.assertRaisesRegex(TypeError, "positive integer",
7068 meth, file, count=0.1)
7069 self.assertRaisesRegex(ValueError, "positive integer",
7070 meth, file, count=0)
7071 self.assertRaisesRegex(ValueError, "positive integer",
7072 meth, file, count=-1)
7073
7074
7075@unittest.skipUnless(hasattr(os, "sendfile"),

Callers

nothing calls this directly

Calls 4

meth_from_sockMethod · 0.95
socketMethod · 0.80
assertRaisesRegexMethod · 0.80
openFunction · 0.50

Tested by

no test coverage detected