Use assertEqual() rather than assertEquals() in Python tests.
The latter form is deprecated, and can generate extraneous output when
running the tests:
DeprecationWarning: Please use assertEqual instead.
Bug: 984182, 1007872
Change-Id: Ibac81178e719a739560bbc65e0f6b9eda40b313a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1859995
Auto-Submit: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py
index aeec60c..8cf43c0 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -166,9 +166,9 @@
cl.description = 'x'
cl.has_description = True
cl.FetchDescription = lambda *a, **kw: 'y'
- self.assertEquals(cl.GetDescription(), 'x')
- self.assertEquals(cl.GetDescription(force=True), 'y')
- self.assertEquals(cl.GetDescription(), 'y')
+ self.assertEqual(cl.GetDescription(), 'x')
+ self.assertEqual(cl.GetDescription(force=True), 'y')
+ self.assertEqual(cl.GetDescription(), 'y')
def test_description_footers(self):
cl = git_cl.Changelist(issue=1, codereview_host='host')
@@ -184,14 +184,14 @@
cl.has_description = True
cl.UpdateDescriptionRemote = lambda *a, **kw: 'y'
msg, footers = cl.GetDescriptionFooters()
- self.assertEquals(
+ self.assertEqual(
msg, ['This is some message', '', 'It has some lines', 'and, also'])
- self.assertEquals(footers, [('Some', 'Really'), ('Awesome', 'Footers')])
+ self.assertEqual(footers, [('Some', 'Really'), ('Awesome', 'Footers')])
msg.append('wut')
footers.append(('gnarly-dude', 'beans'))
cl.UpdateDescriptionFooters(msg, footers)
- self.assertEquals(cl.GetDescription().splitlines(), [
+ self.assertEqual(cl.GetDescription().splitlines(), [
'This is some message',
'',
'It has some lines',
@@ -667,7 +667,7 @@
def tearDown(self):
try:
- self.assertEquals([], self.calls)
+ self.assertEqual([], self.calls)
except AssertionError:
if not self.has_failed():
raise
@@ -1585,8 +1585,8 @@
ret = git_cl.upload_branch_deps(MockChangelist(), [])
# CMDupload should have been called 5 times because of 5 dependent branches.
- self.assertEquals(5, record_calls.times_called)
- self.assertEquals(0, ret)
+ self.assertEqual(5, record_calls.times_called)
+ self.assertEqual(0, ret)
def test_gerrit_change_id(self):
self.calls = [
@@ -2146,7 +2146,7 @@
self.mock(git_cl.sys, 'stdout', out)
def assertIssue(cl_self, *_args):
- self.assertEquals(cl_self.issue, 1)
+ self.assertEqual(cl_self.issue, 1)
return 'foobar'
self.mock(git_cl.Changelist, 'GetDescription', assertIssue)
@@ -2158,7 +2158,7 @@
def test_SetCloseOverrideIssue(self):
def assertIssue(cl_self, *_args):
- self.assertEquals(cl_self.issue, 1)
+ self.assertEqual(cl_self.issue, 1)
return 'foobar'
self.mock(git_cl.Changelist, 'GetDescription', assertIssue)
@@ -2204,7 +2204,7 @@
current_desc = 'Some.\n\nChange-Id: xxx'
def RunEditor(desc, _, **kwargs):
- self.assertEquals(
+ self.assertEqual(
'# Enter a description of the change.\n'
'# This will be displayed on the codereview site.\n'
'# The first line will also be used as the subject of the review.\n'
@@ -2216,7 +2216,7 @@
return 'Some.\n\nChange-Id: xxx\nBug: 123'
def UpdateDescriptionRemote(_, desc, force=False):
- self.assertEquals(desc, 'Some.\n\nChange-Id: xxx\nBug: 123')
+ self.assertEqual(desc, 'Some.\n\nChange-Id: xxx\nBug: 123')
self.mock(git_cl.sys, 'stdout', StringIO.StringIO())
self.mock(git_cl.Changelist, 'GetDescription',
@@ -2238,7 +2238,7 @@
current_desc = 'Some.\n\nFixed: 123\nChange-Id: xxx'
def RunEditor(desc, _, **kwargs):
- self.assertEquals(
+ self.assertEqual(
'# Enter a description of the change.\n'
'# This will be displayed on the codereview site.\n'
'# The first line will also be used as the subject of the review.\n'