diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2010-11-20 19:04:17 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2010-11-20 19:04:17 (GMT) |
commit | b3aedd48621ed9d33b5f42f946b256bce4a50673 (patch) | |
tree | 2297c8ebce1b09621e1d98096c1603896d9a0f0c /Lib/test/test_socket.py | |
parent | b8bc439b2093add9b313bcca2cc507a2d0e87764 (diff) | |
download | cpython-b3aedd48621ed9d33b5f42f946b256bce4a50673.zip cpython-b3aedd48621ed9d33b5f42f946b256bce4a50673.tar.gz cpython-b3aedd48621ed9d33b5f42f946b256bce4a50673.tar.bz2 |
#9424: Replace deprecated assert* methods in the Python test suite.
Diffstat (limited to 'Lib/test/test_socket.py')
-rw-r--r-- | Lib/test/test_socket.py | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 9f27a51..32084da 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -446,8 +446,8 @@ class GeneralModuleTests(unittest.TestCase): return # No inet_aton, nothing to check # Test that issue1008086 and issue767150 are fixed. # It must return 4 bytes. - self.assertEquals(b'\x00'*4, socket.inet_aton('0.0.0.0')) - self.assertEquals(b'\xff'*4, socket.inet_aton('255.255.255.255')) + self.assertEqual(b'\x00'*4, socket.inet_aton('0.0.0.0')) + self.assertEqual(b'\xff'*4, socket.inet_aton('255.255.255.255')) def testIPv4toString(self): if not hasattr(socket, 'inet_pton'): @@ -455,16 +455,16 @@ class GeneralModuleTests(unittest.TestCase): from socket import inet_aton as f, inet_pton, AF_INET g = lambda a: inet_pton(AF_INET, a) - self.assertEquals(b'\x00\x00\x00\x00', f('0.0.0.0')) - self.assertEquals(b'\xff\x00\xff\x00', f('255.0.255.0')) - self.assertEquals(b'\xaa\xaa\xaa\xaa', f('170.170.170.170')) - self.assertEquals(b'\x01\x02\x03\x04', f('1.2.3.4')) - self.assertEquals(b'\xff\xff\xff\xff', f('255.255.255.255')) + self.assertEqual(b'\x00\x00\x00\x00', f('0.0.0.0')) + self.assertEqual(b'\xff\x00\xff\x00', f('255.0.255.0')) + self.assertEqual(b'\xaa\xaa\xaa\xaa', f('170.170.170.170')) + self.assertEqual(b'\x01\x02\x03\x04', f('1.2.3.4')) + self.assertEqual(b'\xff\xff\xff\xff', f('255.255.255.255')) - self.assertEquals(b'\x00\x00\x00\x00', g('0.0.0.0')) - self.assertEquals(b'\xff\x00\xff\x00', g('255.0.255.0')) - self.assertEquals(b'\xaa\xaa\xaa\xaa', g('170.170.170.170')) - self.assertEquals(b'\xff\xff\xff\xff', g('255.255.255.255')) + self.assertEqual(b'\x00\x00\x00\x00', g('0.0.0.0')) + self.assertEqual(b'\xff\x00\xff\x00', g('255.0.255.0')) + self.assertEqual(b'\xaa\xaa\xaa\xaa', g('170.170.170.170')) + self.assertEqual(b'\xff\xff\xff\xff', g('255.255.255.255')) def testIPv6toString(self): if not hasattr(socket, 'inet_pton'): @@ -477,10 +477,10 @@ class GeneralModuleTests(unittest.TestCase): return f = lambda a: inet_pton(AF_INET6, a) - self.assertEquals(b'\x00' * 16, f('::')) - self.assertEquals(b'\x00' * 16, f('0::0')) - self.assertEquals(b'\x00\x01' + b'\x00' * 14, f('1::')) - self.assertEquals( + self.assertEqual(b'\x00' * 16, f('::')) + self.assertEqual(b'\x00' * 16, f('0::0')) + self.assertEqual(b'\x00\x01' + b'\x00' * 14, f('1::')) + self.assertEqual( b'\x45\xef\x76\xcb\x00\x1a\x56\xef\xaf\xeb\x0b\xac\x19\x24\xae\xae', f('45ef:76cb:1a:56ef:afeb:bac:1924:aeae') ) @@ -491,14 +491,14 @@ class GeneralModuleTests(unittest.TestCase): from socket import inet_ntoa as f, inet_ntop, AF_INET g = lambda a: inet_ntop(AF_INET, a) - self.assertEquals('1.0.1.0', f(b'\x01\x00\x01\x00')) - self.assertEquals('170.85.170.85', f(b'\xaa\x55\xaa\x55')) - self.assertEquals('255.255.255.255', f(b'\xff\xff\xff\xff')) - self.assertEquals('1.2.3.4', f(b'\x01\x02\x03\x04')) + self.assertEqual('1.0.1.0', f(b'\x01\x00\x01\x00')) + self.assertEqual('170.85.170.85', f(b'\xaa\x55\xaa\x55')) + self.assertEqual('255.255.255.255', f(b'\xff\xff\xff\xff')) + self.assertEqual('1.2.3.4', f(b'\x01\x02\x03\x04')) - self.assertEquals('1.0.1.0', g(b'\x01\x00\x01\x00')) - self.assertEquals('170.85.170.85', g(b'\xaa\x55\xaa\x55')) - self.assertEquals('255.255.255.255', g(b'\xff\xff\xff\xff')) + self.assertEqual('1.0.1.0', g(b'\x01\x00\x01\x00')) + self.assertEqual('170.85.170.85', g(b'\xaa\x55\xaa\x55')) + self.assertEqual('255.255.255.255', g(b'\xff\xff\xff\xff')) def testStringToIPv6(self): if not hasattr(socket, 'inet_ntop'): @@ -511,9 +511,9 @@ class GeneralModuleTests(unittest.TestCase): return f = lambda a: inet_ntop(AF_INET6, a) - self.assertEquals('::', f(b'\x00' * 16)) - self.assertEquals('::1', f(b'\x00' * 15 + b'\x01')) - self.assertEquals( + self.assertEqual('::', f(b'\x00' * 16)) + self.assertEqual('::1', f(b'\x00' * 15 + b'\x01')) + self.assertEqual( 'aef:b01:506:1001:ffff:9997:55:170', f(b'\x0a\xef\x0b\x01\x05\x06\x10\x01\xff\xff\x99\x97\x00\x55\x01\x70') ) @@ -1226,8 +1226,8 @@ class FileObjectInterruptedTestCase(unittest.TestCase): lambda : b"", # XXX(gps): io library does an extra EOF read ]) fo = mock_sock._textiowrap_for_test(buffering=buffering) - self.assertEquals(fo.readline(size), "This is the first line\n") - self.assertEquals(fo.readline(size), "And the second line is here\n") + self.assertEqual(fo.readline(size), "This is the first line\n") + self.assertEqual(fo.readline(size), "And the second line is here\n") def _test_read(self, size=-1, buffering=-1): mock_sock = self.MockSocket(recv_funcs=[ @@ -1250,7 +1250,7 @@ class FileObjectInterruptedTestCase(unittest.TestCase): if not part: break data += part - self.assertEquals(data, expecting) + self.assertEqual(data, expecting) def test_default(self): self._test_readline() @@ -1274,8 +1274,8 @@ class FileObjectInterruptedTestCase(unittest.TestCase): lambda : b"", ]) fo = mock_sock._textiowrap_for_test(buffering=0) - self.assertEquals(fo.readline(size), b"a\n") - self.assertEquals(fo.readline(size), b"Bb") + self.assertEqual(fo.readline(size), b"a\n") + self.assertEqual(fo.readline(size), b"Bb") def test_no_buffer(self): self._test_readline_no_buffer() @@ -1525,7 +1525,7 @@ class NetworkConnectionAttributesTest(SocketTCPTest, ThreadableTest): self.addCleanup(self.cli.close) finally: socket.setdefaulttimeout(None) - self.assertEquals(self.cli.gettimeout(), 42) + self.assertEqual(self.cli.gettimeout(), 42) testTimeoutNone = _justAccept def _testTimeoutNone(self): |