MCPcopy Create free account
hub / github.com/RustPython/RustPython / test_errors

Method test_errors

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

Source from the content-addressed store, hash-verified

6946 pass
6947
6948 def test_errors(self):
6949 with open(os_helper.TESTFN, 'rb') as file:
6950 with socket.socket(type=socket.SOCK_DGRAM) as s:
6951 meth = self.meth_from_sock(s)
6952 self.assertRaisesRegex(
6953 ValueError, "SOCK_STREAM", meth, file)
6954 with open(os_helper.TESTFN, encoding="utf-8") as file:
6955 with socket.socket() as s:
6956 meth = self.meth_from_sock(s)
6957 self.assertRaisesRegex(
6958 ValueError, "binary mode", meth, file)
6959 with open(os_helper.TESTFN, 'rb') as file:
6960 with socket.socket() as s:
6961 meth = self.meth_from_sock(s)
6962 self.assertRaisesRegex(TypeError, "positive integer",
6963 meth, file, count='2')
6964 self.assertRaisesRegex(TypeError, "positive integer",
6965 meth, file, count=0.1)
6966 self.assertRaisesRegex(ValueError, "positive integer",
6967 meth, file, count=0)
6968 self.assertRaisesRegex(ValueError, "positive integer",
6969 meth, file, count=-1)
6970
6971
6972@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