mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Refactor buggy test to correctly use the msg argument of assertRaises.
This commit is contained in:
parent
43432b84c3
commit
845f1526a3
1 changed files with 4 additions and 9 deletions
|
@ -270,18 +270,13 @@ class GeneralModuleTests(unittest.TestCase):
|
||||||
|
|
||||||
def testSocketError(self):
|
def testSocketError(self):
|
||||||
# Testing socket module exceptions
|
# Testing socket module exceptions
|
||||||
def raise_error(*args, **kwargs):
|
msg = "Error raising socket exception (%s)."
|
||||||
|
with self.assertRaises(socket.error, msg=msg % 'socket.error'):
|
||||||
raise socket.error
|
raise socket.error
|
||||||
def raise_herror(*args, **kwargs):
|
with self.assertRaises(socket.error, msg=msg % 'socket.herror'):
|
||||||
raise socket.herror
|
raise socket.herror
|
||||||
def raise_gaierror(*args, **kwargs):
|
with self.assertRaises(socket.error, msg=msg % 'socket.gaierror'):
|
||||||
raise socket.gaierror
|
raise socket.gaierror
|
||||||
self.assertRaises(socket.error, raise_error,
|
|
||||||
"Error raising socket exception.")
|
|
||||||
self.assertRaises(socket.error, raise_herror,
|
|
||||||
"Error raising socket exception.")
|
|
||||||
self.assertRaises(socket.error, raise_gaierror,
|
|
||||||
"Error raising socket exception.")
|
|
||||||
|
|
||||||
def testSendtoErrors(self):
|
def testSendtoErrors(self):
|
||||||
# Testing that sendto doens't masks failures. See #10169.
|
# Testing that sendto doens't masks failures. See #10169.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue