Commit 7870c067 authored by Arkadiusz Hiler's avatar Arkadiusz Hiler
Browse files

Change deprecated assertEquals to assertEqual


Signed-off-by: default avatarArkadiusz Hiler <arkadiusz.hiler@intel.com>
parent 49637d17
......@@ -509,19 +509,19 @@ class MultipleProjectsPerMailingListTest(TestCase):
def testTagList(self):
self.project1.subject_prefix_tags = ''
self.assertEquals(self.project1.get_subject_prefix_tags(), [])
self.assertEqual(self.project1.get_subject_prefix_tags(), [])
self.project1.subject_prefix_tags = ' '
self.assertEquals(self.project1.get_subject_prefix_tags(), [])
self.assertEqual(self.project1.get_subject_prefix_tags(), [])
self.project1.subject_prefix_tags = 'i-g-t'
self.assertEquals(self.project1.get_subject_prefix_tags(), ['i-g-t'])
self.assertEqual(self.project1.get_subject_prefix_tags(), ['i-g-t'])
self.project1.subject_prefix_tags = 'a,b'
self.assertEquals(self.project1.get_subject_prefix_tags(), ['a', 'b'])
self.assertEqual(self.project1.get_subject_prefix_tags(), ['a', 'b'])
self.project1.subject_prefix_tags = 'a, ,b,'
self.assertEquals(self.project1.get_subject_prefix_tags(), ['a', 'b'])
self.assertEqual(self.project1.get_subject_prefix_tags(), ['a', 'b'])
def testSingleTag(self):
self.project2.subject_prefix_tags = 'i-g-t'
......@@ -529,10 +529,10 @@ class MultipleProjectsPerMailingListTest(TestCase):
email = create_email(defaults.patch, project=self.project1,
subject='[PATCH] Subject')
self.assertEquals(find_project(email), self.project1)
self.assertEqual(find_project(email), self.project1)
email = create_email(defaults.patch, project=self.project1,
subject='[PATCH i-g-t] Subject')
self.assertEquals(find_project(email), self.project2)
self.assertEqual(find_project(email), self.project2)
def testSingleTagInverted(self):
"""To test the order_by()"""
......@@ -541,10 +541,10 @@ class MultipleProjectsPerMailingListTest(TestCase):
email = create_email(defaults.patch, project=self.project1,
subject='[PATCH i-g-t] Subject')
self.assertEquals(find_project(email), self.project1)
self.assertEqual(find_project(email), self.project1)
email = create_email(defaults.patch, project=self.project1,
subject='[PATCH] Subject')
self.assertEquals(find_project(email), self.project2)
self.assertEqual(find_project(email), self.project2)
def testMultipleTags(self):
self.project2.subject_prefix_tags = 'i-g-t,intel-gpu-tools'
......@@ -552,13 +552,13 @@ class MultipleProjectsPerMailingListTest(TestCase):
email = create_email(defaults.patch, project=self.project1,
subject='[PATCH] Subject')
self.assertEquals(find_project(email), self.project1)
self.assertEqual(find_project(email), self.project1)
email = create_email(defaults.patch, project=self.project1,
subject='[PATCH i-g-t] Subject')
self.assertEquals(find_project(email), self.project2)
self.assertEqual(find_project(email), self.project2)
email = create_email(defaults.patch, project=self.project1,
subject='[PATCH intel-gpu-tools] Subject')
self.assertEquals(find_project(email), self.project2)
self.assertEqual(find_project(email), self.project2)
def testStripTag(self):
self.project2.subject_prefix_tags = 'i-g-t'
......@@ -567,7 +567,7 @@ class MultipleProjectsPerMailingListTest(TestCase):
subject='[PATCH i-g-t] Subject')
parse_mail(email)
patch = Patch.objects.all()[0]
self.assertEquals(patch.name, 'Subject')
self.assertEqual(patch.name, 'Subject')
def testStripListemailTag(self):
self.project3.subject_prefix_tags = 'i-g-t'
......@@ -577,7 +577,7 @@ class MultipleProjectsPerMailingListTest(TestCase):
subject='[intel-gfx] [PATCH i-g-t] Subject')
parse_mail(email)
patch = Patch.objects.all()[0]
self.assertEquals(patch.name, 'Subject')
self.assertEqual(patch.name, 'Subject')
class MBoxPatchTest(PatchTest):
......@@ -886,7 +886,7 @@ class InitialPatchStateTest(MailFromPatchTest):
class GitSendEmailTest(MailFromPatchTest):
def _assertNPatches(self, n):
self.assertEquals(Patch.objects.count(), n)
self.assertEqual(Patch.objects.count(), n)
def testSettingOffGitSendEmail(self):
"""git_send_email_only is false (default value) and email has been sent
......@@ -943,9 +943,9 @@ class GitSendEmailTest(MailFromPatchTest):
content = find_content(self.p1, email)
self.assertTrue(content.patch is not None)
self.assertEquals(content.patch.content, self.patch)
self.assertEqual(content.patch.content, self.patch)
self.assertTrue(content.comment is not None)
self.assertEquals(content.comment.content, 'See attached patch!')
self.assertEqual(content.comment.content, 'See attached patch!')
class ParseInitialTagsTest(PatchTest):
......
......@@ -293,7 +293,7 @@ class APITest(APITestBase):
response = self.client.get('/api/1.0' +
"/series/%s/revisions/1/cover/" % self.series3.pk)
self.assertEquals(response.status_code, 404)
self.assertEqual(response.status_code, 404)
def _check_mbox_link(self, url, n):
response = self.client.get('/api/1.0' + url, {'link': 'Patchwork'})
......@@ -494,11 +494,11 @@ class MsgidsLookupTest(APITestBase):
response = self.get_json(self.msgid_url.format(self.patch.msgid))
results = response['results']
self.assertEquals(response['count'], 1) # just one matching patch
self.assertEquals(results[0]['patch_id'], self.patch.id)
self.assertEquals(results[0]['project_id'], self.patch.project_id)
self.assertEquals(results[0]['series_id'], self.patch.series().id)
self.assertEquals(results[0]['revision_ids'], [self.revision.version])
self.assertEqual(response['count'], 1) # just one matching patch
self.assertEqual(results[0]['patch_id'], self.patch.id)
self.assertEqual(results[0]['project_id'], self.patch.project_id)
self.assertEqual(results[0]['series_id'], self.patch.series().id)
self.assertEqual(results[0]['revision_ids'], [self.revision.version])
def testUnbracketedLookup(self):
msgid = self.patch.msgid
......@@ -510,7 +510,7 @@ class MsgidsLookupTest(APITestBase):
response2 = self.get_json(self.msgid_url.format(stripped_msgid))
self.assertTrue(response1['count'] != 0)
self.assertEquals(response1, response2)
self.assertEqual(response1, response2)
def testSingleSeriesMultipleRevisionsLookup(self):
rev2 = self.revision.duplicate()
......@@ -518,8 +518,8 @@ class MsgidsLookupTest(APITestBase):
response = self.get_json(self.msgid_url.format(self.patch.msgid))
results = response['results']
self.assertEquals(response['count'], 1) # just one matching patch
self.assertEquals(results[0]['revision_ids'], # multiple revs
self.assertEqual(response['count'], 1) # just one matching patch
self.assertEqual(results[0]['revision_ids'], # multiple revs
[self.revision.version, rev2.version])
def testMulitpleSeriesSingleRevisionsLookup(self):
......@@ -536,17 +536,17 @@ class MsgidsLookupTest(APITestBase):
response = self.get_json(self.msgid_url.format(self.patch.msgid))
self.assertEquals(response['count'], 2)
self.assertEqual(response['count'], 2)
def testCoverLetterLookup(self):
response = self.get_json(self.msgid_url.format(self.root_msgid))
results = response['results']
self.assertEquals(response['count'], 1)
self.assertEqual(response['count'], 1)
self.assertTrue('patch_id' not in results[0].keys())
self.assertEquals(results[0]['project_id'], self.series.project_id)
self.assertEquals(results[0]['series_id'], self.series.id)
self.assertEquals(results[0]['revision_ids'], [self.revision.version])
self.assertEqual(results[0]['project_id'], self.series.project_id)
self.assertEqual(results[0]['series_id'], self.series.id)
self.assertEqual(results[0]['revision_ids'], [self.revision.version])
class TestResultTest(APITestBase):
......
......@@ -56,34 +56,34 @@ class SeriesTest(TestCase):
# make sure the series has been correctly populated
series = Series.objects.all()
self.assertEquals(series.count(), 1)
self.assertEqual(series.count(), 1)
s = series[0]
self.assertEquals(s.project, self.project)
self.assertEquals(s.name, self.series_name)
self.assertEqual(s.project, self.project)
self.assertEqual(s.name, self.series_name)
# same thing for the revision
revisions = SeriesRevision.objects.all()
self.assertEquals(revisions.count(), 1)
self.assertEqual(revisions.count(), 1)
r = revisions[0]
self.assertEquals(r.series_id, s.id)
self.assertEquals(r.root_msgid, self.root_msgid)
self.assertEquals(r.cover_letter, self.cover_letter)
self.assertEqual(r.series_id, s.id)
self.assertEqual(r.root_msgid, self.root_msgid)
self.assertEqual(r.cover_letter, self.cover_letter)
# and list of patches
r_patches = r.patches.all()
self.assertEquals(r_patches.count(), self.n_patches)
self.assertEqual(r_patches.count(), self.n_patches)
# Make sure we also insert patches. Most thorough checks on patches
# isn't the subject here.
patches = Patch.objects.all()
self.assertEquals(patches.count(), self.n_patches)
self.assertEqual(patches.count(), self.n_patches)
# We are inserting a single series, so the logs should only have one
# entry
logs = EventLog.objects.all()
self.assertEquals(logs.count(), 1)
self.assertEqual(logs.count(), 1)
def check_revision_summary(self, revision, expected):
self.assertIsNotNone(revision.state_summary)
......@@ -91,7 +91,7 @@ class SeriesTest(TestCase):
for entry in summary:
state = entry['name']
count = entry['count']
self.assertEquals(expected[state], count)
self.assertEqual(expected[state], count)
class GeneratedSeriesTest(SeriesTest):
......@@ -157,7 +157,7 @@ class RevisionStatus(GeneratedSeriesTest):
event_count = EventLog.objects.all().count()
self.test_series.insert([extra])
self.assertEquals(EventLog.objects.all().count(), event_count)
self.assertEqual(EventLog.objects.all().count(), event_count)
def testSeriesWithWrongOrderingShouldBeCompleteAndStrange(self):
# replace patch 1/3 with a patch that is numbered 2/3
......@@ -197,9 +197,9 @@ class BasicGeneratedSeriesTests(GeneratedSeriesTest):
series = TestSeries(2)
series.insert()
series = Series.objects.all()[0]
self.assertEquals(str(series), defaults.series_name)
self.assertEqual(str(series), defaults.series_name)
revision = series.revisions()[0]
self.assertEquals(str(revision), 'Revision 1')
self.assertEqual(str(revision), 'Revision 1')
class SeriesViewTest(GeneratedSeriesTest):
......@@ -237,7 +237,7 @@ class Series0001(SingleMailSeries):
# make sure we got the right patch inserted as well
patches = Patch.objects.all()
patch = patches[0]
self.assertEquals(patch.msgid, self.root_msgid)
self.assertEqual(patch.msgid, self.root_msgid)
class Series0010(IntelGfxTest):
......@@ -328,15 +328,15 @@ http://lists.freedesktop.org/mailman/listinfo/intel-gfx
sr = SeriesRevision.objects.get() # we have just one
stored_headers = HeaderParser().parsestr(sr.raw_cover_letter_headers)
self.assertEquals(sr.raw_cover_letter, self.raw_cover_letter)
self.assertEqual(sr.raw_cover_letter, self.raw_cover_letter)
self.assertEquals(stored_headers['From'],
self.assertEqual(stored_headers['From'],
'Damien Lespiau <damien.lespiau@intel.com>')
self.assertEquals(stored_headers['To'],
self.assertEqual(stored_headers['To'],
'<intel-gfx@lists.freedesktop.org>')
self.assertEquals(stored_headers['Date'],
self.assertEqual(stored_headers['Date'],
'Tue, 13 May 2014 23:32:20 +0100')
self.assertEquals(stored_headers['Subject'],
self.assertEqual(stored_headers['Subject'],
'[Intel-gfx] [PATCH 0/4] for_each_{intel_,}crtc v2')
......@@ -393,14 +393,14 @@ class ReferencesListTest(TestCase):
series = TestSeries(1, has_cover_letter=False)
mails = series.create_mails()
refs = build_references_list(mails[0])
self.assertEquals(refs, [])
self.assertEqual(refs, [])
def testThread2Mails(self):
series = TestSeries(1)
mails = series.create_mails()
refs = build_references_list(mails[1])
self.assertEquals(len(refs), 1)
self.assertEquals(refs[0], mails[0].get('Message-Id'))
self.assertEqual(len(refs), 1)
self.assertEqual(refs[0], mails[0].get('Message-Id'))
def setMessageId(self, mail, msgid):
del mail['Message-Id']
......@@ -443,7 +443,7 @@ class ReferencesListTest(TestCase):
patch_v3 = series.create_patch(2, in_reply_to=reply_4,
subject_prefix="PATCH v3")
self.setMessageId(patch_v3, 'patch_2_3_v3')
self.assertEquals(build_references_list(patch_v3),
self.assertEqual(build_references_list(patch_v3),
[reply_4.get('Message-Id'),
patch_v2.get('Message-Id'),
reply_3.get('Message-Id'),
......@@ -473,41 +473,41 @@ class UpdatedPatchTest(Series0030):
def testNewRevision(self):
series = Series.objects.all()[0]
self.assertEquals(series.last_revision.version, 2)
self.assertEqual(series.last_revision.version, 2)
revisions = SeriesRevision.objects.all()
self.assertEquals(revisions.count(), 2)
self.assertEqual(revisions.count(), 2)
r = revisions[0]
self.assertEquals(r.series_id, series.id)
self.assertEquals(r.root_msgid, self.root_msgid)
self.assertEquals(r.patches.count(), 1)
self.assertEqual(r.series_id, series.id)
self.assertEqual(r.root_msgid, self.root_msgid)
self.assertEqual(r.patches.count(), 1)
p = r.patches.all()[0]
self.assertEquals(p.msgid, self.root_msgid)
self.assertEqual(p.msgid, self.root_msgid)
r = revisions[1]
self.assertEquals(r.series_id, series.id)
self.assertEquals(r.root_msgid, self.root_msgid)
self.assertEquals(r.patches.count(), 1)
self.assertEqual(r.series_id, series.id)
self.assertEqual(r.root_msgid, self.root_msgid)
self.assertEqual(r.patches.count(), 1)
p = r.patches.all()[0]
self.assertEquals(p.msgid,
self.assertEqual(p.msgid,
'<1427980954-15015-1-git-send-email-deepak.s@linux.intel.com>')
class SinglePatchUpdateTest(GeneratedSeriesTest):
def check_revision(self, series, revision):
self.assertEquals(revision.series_id, series.id)
self.assertEquals(revision.root_msgid, self.root_msgid)
self.assertEquals(revision.patches.count(), self.n_patches)
self.assertEqual(revision.series_id, series.id)
self.assertEqual(revision.root_msgid, self.root_msgid)
self.assertEqual(revision.patches.count(), self.n_patches)
def check(self, original_mails, patch_v2_mail, n):
self.assertEquals(Series.objects.count(), 1)
self.assertEqual(Series.objects.count(), 1)
series = Series.objects.all()[0]
self.assertEquals(series.last_revision.version, 2)
self.assertEqual(series.last_revision.version, 2)
revisions = SeriesRevision.objects.all()
self.assertEquals(revisions.count(), 2)
self.assertEqual(revisions.count(), 2)
r = revisions[0]
self.check_revision(series, r)
......@@ -516,13 +516,13 @@ class SinglePatchUpdateTest(GeneratedSeriesTest):
patch_mail = original_mails[n]
else:
patch_mail = original_mails[n - 1]
self.assertEquals(p.msgid, patch_mail.get('Message-Id'))
self.assertEqual(p.msgid, patch_mail.get('Message-Id'))
r = revisions[1]
self.check_revision(series, r)
self.assertEquals(r.cover_letter, self.cover_letter)
self.assertEqual(r.cover_letter, self.cover_letter)
p = r.ordered_patches()[n - 1]
self.assertEquals(p.msgid, patch_v2_mail.get('Message-Id'))
self.assertEqual(p.msgid, patch_v2_mail.get('Message-Id'))
def _test_internal(self, n_patches, n_updated, has_cover_letter=True):
(test, mails) = self._create_series(n_patches, has_cover_letter)
......@@ -608,12 +608,12 @@ class SinglePatchUpdatesVariousCornerCasesTest(TestCase):
mails.append(patch_v3)
dummy.insert(mails)
self.assertEquals(Series.objects.count(), 1)
self.assertEqual(Series.objects.count(), 1)
series = Series.objects.all()[0]
self.assertEquals(series.last_revision.version, 3)
self.assertEqual(series.last_revision.version, 3)
revisions = SeriesRevision.objects.all()
self.assertEquals(revisions.count(), 3)
self.assertEqual(revisions.count(), 3)
revision = revisions[0]
patches = revision.ordered_patches()
......@@ -645,12 +645,12 @@ class SinglePatchUpdatesVariousCornerCasesTest(TestCase):
series.insert(mails)
self.assertEquals(Series.objects.count(), 1)
self.assertEqual(Series.objects.count(), 1)
series = Series.objects.all()[0]
self.assertEquals(series.last_revision.version, 2)
self.assertEqual(series.last_revision.version, 2)
revisions = SeriesRevision.objects.all()
self.assertEquals(revisions.count(), 2)
self.assertEqual(revisions.count(), 2)
revision = revisions[0]
patches = revision.ordered_patches()
......@@ -725,33 +725,33 @@ class FullSeriesUpdateTest(GeneratedSeriesTest):
n_patches = len(mails)
if self.has_cover_letter:
n_patches -= 1
self.assertEquals(n_patches, ref_n_patches)
self.assertEqual(n_patches, ref_n_patches)
self.assertEquals(revision.series_id, series.id)
self.assertEquals(revision.root_msgid, mails[0].get('Message-Id'))
self.assertEquals(revision.patches.count(), n_patches)
self.assertEquals(revision.n_patches, n_patches)
self.assertEqual(revision.series_id, series.id)
self.assertEqual(revision.root_msgid, mails[0].get('Message-Id'))
self.assertEqual(revision.patches.count(), n_patches)
self.assertEqual(revision.n_patches, n_patches)
i = 1 if self.has_cover_letter else 0
for patch in revision.ordered_patches():
patch_mail = mails[i]
self.assertEquals(patch.msgid, patch_mail.get('Message-Id'))
self.assertEqual(patch.msgid, patch_mail.get('Message-Id'))
i += 1
def check(self, series1_mails, series2_mails, n_patches):
self.assertEquals(Series.objects.count(), 1)
self.assertEqual(Series.objects.count(), 1)
series = Series.objects.all()[0]
self.assertEquals(series.last_revision.version, 2)
self.assertEqual(series.last_revision.version, 2)
revisions = SeriesRevision.objects.all()
self.assertEquals(revisions.count(), 2)
self.assertEqual(revisions.count(), 2)
self.check_revision(series, revisions[0], series1_mails, n_patches[0])
self.check_revision(series, revisions[1], series2_mails, n_patches[1])
# Make sure we've created an event per revision (and so we've correctly
# picked up the 2 revisions even if the number of patches changes)
self.assertEquals(EventLog.objects.all().count(), 2)
self.assertEqual(EventLog.objects.all().count(), 2)
def _set_cover_letter_subject(self, mail, n_patches, subject):
del mail['Subject']
......@@ -785,7 +785,7 @@ class FullSeriesUpdateTest(GeneratedSeriesTest):
('Awesome series', 'Awesome series, take 6'),
)
for case in cases:
self.assertEquals(clean_series_name(case[1]), case[0])
self.assertEqual(clean_series_name(case[1]), case[0])
def testNewSeries(self):
self._test_internal((3, 3), ('Awesome series', 'Awesome series (v4)'))
......@@ -859,10 +859,10 @@ class SeriesRevisionTest(GeneratedSeriesTest):
self.assertNotEqual(dup.pk, org.pk)
self.assertEquals(dup.version, org.version + 1)
self.assertEquals(dup.cover_letter, org.cover_letter)
self.assertEquals(dup.raw_cover_letter, org.raw_cover_letter)
self.assertEquals(dup.raw_cover_letter_headers,
self.assertEqual(dup.version, org.version + 1)
self.assertEqual(dup.cover_letter, org.cover_letter)
self.assertEqual(dup.raw_cover_letter, org.raw_cover_letter)
self.assertEqual(dup.raw_cover_letter_headers,
org.raw_cover_letter_headers)
......@@ -885,11 +885,11 @@ class EventLogTest(SingleMailSeries):
def testNewSeriesSeries(self):
entry = EventLog.objects.all()[0]
series = Series.objects.all()[0]
self.assertEquals(entry.series, series)
self.assertEqual(entry.series, series)
def testNewSeriesUser(self):
entry = EventLog.objects.all()[0]
self.assertEquals(self.user, entry.user)
self.assertEqual(self.user, entry.user)
class MultipleMailCoverLetterSeriesIncomplete(Series0010):
......@@ -905,7 +905,7 @@ class EventLogIncompleteTest(MultipleMailCoverLetterSeriesIncomplete):
def testNoNewSeriesIfIncomplete(self):
logs = EventLog.objects.all()
self.assertEquals(logs.count(), 0)
self.assertEqual(logs.count(), 0)
#
# patch-state-change event tests
......@@ -923,7 +923,7 @@ class StateChangeEventLogTest(Series0010):
patch.save()
update_count += 1
stateChangeLogCount = EventLog.objects.filter(event_id=2).count()
self.assertEquals(update_count, stateChangeLogCount)
self.assertEqual(update_count, stateChangeLogCount)
class CoverLetterUpdates(IntelGfxTest):
......@@ -943,7 +943,7 @@ class CoverLetterUpdates(IntelGfxTest):
test_series_updated.insert(updated_mails)
revisions = list(SeriesRevision.objects.all())
self.assertEquals(len(revisions), 2)
self.assertEqual(len(revisions), 2)
original = revisions[0]
updated = revisions[1]
......
......@@ -114,4 +114,4 @@ class XMLRPCTest(LiveServerTestCase):
events = EventLog.objects.filter(event_id=2)
self.assertEqual(events.count(), 1)
event = events[0]
self.assertEquals(event.user, self.maintainer.user)
self.assertEqual(event.user, self.maintainer.user)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment