Use assertEqual() rather than assertEquals()

assertEquals() is deprecated:

  http://docs.python.org/2/library/unittest.html#deprecated-aliases
This commit is contained in:
Mark McLoughlin 2013-06-17 23:01:21 +01:00
parent 2f4d53921f
commit d31ae442ca
6 changed files with 26 additions and 26 deletions

View File

@ -313,7 +313,7 @@ class TestSerializer(test_utils.BaseTestCase):
method = client.call if self.call else client.cast
retval = method(self.ctxt, 'foo', **self.args)
if self.retval is not None:
self.assertEquals(retval, 'd' + self.retval)
self.assertEqual(retval, 'd' + self.retval)
class TestVersionCap(test_utils.BaseTestCase):
@ -480,7 +480,7 @@ class TestCanSendVersion(test_utils.BaseTestCase):
else:
can_send = client.can_send_version()
self.assertEquals(can_send, self.can_send)
self.assertEqual(can_send, self.can_send)
class TestCheckForLock(test_utils.BaseTestCase):
@ -528,7 +528,7 @@ class TestCheckForLock(test_utils.BaseTestCase):
client.call({}, 'foo')
if self.warning:
self.assertEquals(len(warnings), 1)
self.assertEqual(len(warnings), 1)
self.assertTrue(self.warning in warnings[0])
else:
self.assertEquals(len(warnings), 0)
self.assertEqual(len(warnings), 0)

View File

@ -117,9 +117,9 @@ class TestDispatcher(test_utils.BaseTestCase):
self.assertTrue(self.ex is not None, ex)
self.assertTrue(isinstance(ex, self.ex), ex)
if isinstance(ex, messaging.NoSuchMethod):
self.assertEquals(ex.method, self.msg.get('method'))
self.assertEqual(ex.method, self.msg.get('method'))
elif isinstance(ex, messaging.UnsupportedVersion):
self.assertEquals(ex.version, self.msg.get('version', '1.0'))
self.assertEqual(ex.version, self.msg.get('version', '1.0'))
else:
self.assertTrue(self.success)
@ -157,4 +157,4 @@ class TestSerializer(test_utils.BaseTestCase):
retval = dispatcher(self.ctxt, dict(method='foo', args=self.args))
if self.retval is not None:
self.assertEquals(retval, 's' + self.retval)
self.assertEqual(retval, 's' + self.retval)

View File

@ -115,7 +115,7 @@ class TestRPCServer(test_utils.BaseTestCase, ServerSetupMixin):
server.start()
except Exception as ex:
self.assertTrue(isinstance(ex, messaging.ServerListenError), ex)
self.assertEquals(ex.target.topic, 'testtopic')
self.assertEqual(ex.target.topic, 'testtopic')
else:
self.assertTrue(False)
@ -127,7 +127,7 @@ class TestRPCServer(test_utils.BaseTestCase, ServerSetupMixin):
server.start()
except Exception as ex:
self.assertTrue(isinstance(ex, messaging.ServerListenError), ex)
self.assertEquals(ex.target.server, 'testserver')
self.assertEqual(ex.target.server, 'testserver')
else:
self.assertTrue(False)
@ -187,7 +187,7 @@ class TestRPCServer(test_utils.BaseTestCase, ServerSetupMixin):
messaging.get_rpc_server(transport, None, [], executor='foo')
except Exception as ex:
self.assertTrue(isinstance(ex, messaging.ExecutorLoadFailure))
self.assertEquals(ex.executor, 'foo')
self.assertEqual(ex.executor, 'foo')
else:
self.assertTrue(False)
@ -210,7 +210,7 @@ class TestRPCServer(test_utils.BaseTestCase, ServerSetupMixin):
self._stop_server(client, server_thread)
self.assertEquals(endpoint.pings, ['dsfoo', 'dsbar'])
self.assertEqual(endpoint.pings, ['dsfoo', 'dsbar'])
def test_call(self):
transport = messaging.get_transport(self.conf, url='fake:')
@ -222,7 +222,7 @@ class TestRPCServer(test_utils.BaseTestCase, ServerSetupMixin):
server_thread = self._setup_server(transport, TestEndpoint())
client = self._setup_client(transport)
self.assertEquals(client.call({}, 'ping', arg='foo'), 'dsdsfoo')
self.assertEqual(client.call({}, 'ping', arg='foo'), 'dsdsfoo')
self._stop_server(client, server_thread)
@ -237,7 +237,7 @@ class TestRPCServer(test_utils.BaseTestCase, ServerSetupMixin):
client = self._setup_client(transport)
direct = client.prepare(server='testserver')
self.assertEquals(direct.call({}, 'ping', arg='foo'), 'dsdsfoo')
self.assertEqual(direct.call({}, 'ping', arg='foo'), 'dsdsfoo')
self._stop_server(client, server_thread)
@ -251,10 +251,10 @@ class TestRPCServer(test_utils.BaseTestCase, ServerSetupMixin):
server_thread = self._setup_server(transport, TestEndpoint())
client = self._setup_client(transport)
self.assertEquals(client.call({'dsa': 'b'},
'ctxt_check',
key='a'),
'dsb')
self.assertEqual(client.call({'dsa': 'b'},
'ctxt_check',
key='a'),
'dsb')
self._stop_server(client, server_thread)
@ -413,7 +413,7 @@ class TestMultipleServers(test_utils.BaseTestCase, ServerSetupMixin):
thread2, topic=self.topic2)
def check(pings, expect):
self.assertEquals(len(pings), len(expect))
self.assertEqual(len(pings), len(expect))
for a in expect:
self.assertTrue(a in pings)

View File

@ -36,7 +36,7 @@ class TargetConstructorTestCase(test_utils.BaseTestCase):
def test_constructor(self):
target = messaging.Target(**self.kwargs)
for k in self.kwargs:
self.assertEquals(getattr(target, k), self.kwargs[k])
self.assertEqual(getattr(target, k), self.kwargs[k])
for k in ['exchange', 'topic', 'namespace',
'version', 'server', 'fanout']:
if k in self.kwargs:
@ -90,7 +90,7 @@ class TargetCallableTestCase(test_utils.BaseTestCase):
target = messaging.Target(**self.attrs)
target = target(**self.kwargs)
for k in self.vals:
self.assertEquals(getattr(target, k), self.vals[k])
self.assertEqual(getattr(target, k), self.vals[k])
for k in ['exchange', 'topic', 'namespace',
'version', 'server', 'fanout']:
if k in self.vals:
@ -122,7 +122,7 @@ class TargetReprTestCase(test_utils.BaseTestCase):
def test_repr(self):
target = messaging.Target(**self.kwargs)
self.assertEquals(str(target), '<Target ' + self.repr + '>')
self.assertEqual(str(target), '<Target ' + self.repr + '>')
_notset = object()
@ -167,7 +167,7 @@ class EqualityTestCase(test_utils.BaseTestCase):
b = messaging.Target(**b_kwargs)
if self.equals:
self.assertEquals(a, b)
self.assertEqual(a, b)
self.assertFalse(a != b)
else:
self.assertNotEquals(a, b)

View File

@ -171,7 +171,7 @@ class GetTransportSadPathTestCase(test_utils.BaseTestCase):
for k, v in self.ex.items():
self.assertTrue(hasattr(ex, k))
self.assertEquals(getattr(ex, k), v)
self.assertEqual(getattr(ex, k), v)
# FIXME(markmc): this could be used elsewhere

View File

@ -52,8 +52,8 @@ class TestExchangeFromURL(test_utils.BaseTestCase):
if self.default is not self._notset:
kwargs['default_exchange'] = self.default
self.assertEquals(urls.exchange_from_url(self.url, **kwargs),
self.expect)
self.assertEqual(urls.exchange_from_url(self.url, **kwargs),
self.expect)
class TestParseURL(test_utils.BaseTestCase):
@ -155,4 +155,4 @@ class TestParseURL(test_utils.BaseTestCase):
]
def test_parse_url(self):
self.assertEquals(urls.parse_url(self.url), self.expect)
self.assertEqual(urls.parse_url(self.url), self.expect)