launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #22097
[Merge] lp:~cjwatson/launchpad/deprecated-assert-methods-2 into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/deprecated-assert-methods-2 into lp:launchpad.
Commit message:
Use modern equivalents of various deprecated TestCase.assert* methods.
Requested reviews:
Colin Watson (cjwatson)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/deprecated-assert-methods-2/+merge/335630
--
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/answers/browser/tests/test_breadcrumbs.py'
--- lib/lp/answers/browser/tests/test_breadcrumbs.py 2017-10-25 10:02:12 +0000
+++ lib/lp/answers/browser/tests/test_breadcrumbs.py 2018-01-02 16:24:23 +0000
@@ -37,21 +37,21 @@
crumbs = self.getBreadcrumbsForObject(
self.product, rootsite='answers')
last_crumb = crumbs[-1]
- self.assertEquals(last_crumb.url, self.product_questions_url)
- self.assertEquals(last_crumb.text, 'Questions')
+ self.assertEqual(last_crumb.url, self.product_questions_url)
+ self.assertEqual(last_crumb.text, 'Questions')
def test_project(self):
crumbs = self.getBreadcrumbsForObject(
self.project, rootsite='answers')
last_crumb = crumbs[-1]
- self.assertEquals(last_crumb.url, self.project_questions_url)
- self.assertEquals(last_crumb.text, 'Questions')
+ self.assertEqual(last_crumb.url, self.project_questions_url)
+ self.assertEqual(last_crumb.text, 'Questions')
def test_person(self):
crumbs = self.getBreadcrumbsForObject(self.person, rootsite='answers')
last_crumb = crumbs[-1]
- self.assertEquals(last_crumb.url, self.person_questions_url)
- self.assertEquals(last_crumb.text, 'Questions')
+ self.assertEqual(last_crumb.url, self.person_questions_url)
+ self.assertEqual(last_crumb.text, 'Questions')
class TestAnswersBreadcrumb(BaseBreadcrumbTestCase):
@@ -68,11 +68,11 @@
self.question_url = canonical_url(self.question, rootsite='answers')
crumbs = self.getBreadcrumbsForObject(self.question)
last_crumb = crumbs[-1]
- self.assertEquals(last_crumb.text, 'Question #%d' % self.question.id)
+ self.assertEqual(last_crumb.text, 'Question #%d' % self.question.id)
def test_faq(self):
self.faq = self.factory.makeFAQ(target=self.product, title='Seedless')
self.faq_url = canonical_url(self.faq, rootsite='answers')
crumbs = self.getBreadcrumbsForObject(self.faq)
last_crumb = crumbs[-1]
- self.assertEquals(last_crumb.text, 'FAQ #%d' % self.faq.id)
+ self.assertEqual(last_crumb.text, 'FAQ #%d' % self.faq.id)
=== modified file 'lib/lp/answers/tests/test_publisher.py'
--- lib/lp/answers/tests/test_publisher.py 2017-10-25 10:02:12 +0000
+++ lib/lp/answers/tests/test_publisher.py 2018-01-02 16:24:23 +0000
@@ -47,6 +47,6 @@
# Responses to requests to answers pages have the 'Vary' header set to
# include Accept-Language.
request = AnswersBrowserRequest(io.StringIO(''), {})
- self.assertEquals(
+ self.assertEqual(
request.response.getHeader('Vary'),
'Cookie, Authorization, Accept-Language')
=== modified file 'lib/lp/answers/tests/test_question_notifications.py'
--- lib/lp/answers/tests/test_question_notifications.py 2017-10-25 10:02:12 +0000
+++ lib/lp/answers/tests/test_question_notifications.py 2018-01-02 16:24:23 +0000
@@ -102,7 +102,7 @@
def test_getSubject(self):
"""getSubject() when there is no message added to the question."""
- self.assertEquals(
+ self.assertEqual(
'Re: [Question #1]: Question title',
self.notification.getSubject())
=== modified file 'lib/lp/answers/tests/test_question_workflow.py'
--- lib/lp/answers/tests/test_question_workflow.py 2018-01-02 10:54:31 +0000
+++ lib/lp/answers/tests/test_question_workflow.py 2018-01-02 16:24:23 +0000
@@ -242,19 +242,18 @@
"""
self.assertTrue(verifyObject(IQuestionMessage, message))
- self.assertEquals("Re: Help!", message.subject)
- self.assertEquals(expected_owner, message.owner)
- self.assertEquals(expected_action, message.action)
- self.assertEquals(expected_status, message.new_status)
+ self.assertEqual("Re: Help!", message.subject)
+ self.assertEqual(expected_owner, message.owner)
+ self.assertEqual(expected_action, message.action)
+ self.assertEqual(expected_status, message.new_status)
- self.assertEquals(message, self.question.messages[-1])
- self.assertEquals(expected_status, self.question.status)
+ self.assertEqual(message, self.question.messages[-1])
+ self.assertEqual(expected_status, self.question.status)
if expected_owner == self.question.owner:
- self.assertEquals(message.datecreated,
- self.question.datelastquery)
+ self.assertEqual(message.datecreated, self.question.datelastquery)
else:
- self.assertEquals(
+ self.assertEqual(
message.datecreated, self.question.datelastresponse)
def checkTransitionEvents(self, message, edited_fields, status_name):
@@ -487,9 +486,9 @@
"""Check additional attributes set when the owner gives the
answers.
"""
- self.assertEquals(None, self.question.answer)
- self.assertEquals(self.owner, self.question.answerer)
- self.assertEquals(message.datecreated, self.question.date_solved)
+ self.assertIsNone(self.question.answer)
+ self.assertEqual(self.owner, self.question.answerer)
+ self.assertEqual(message.datecreated, self.question.date_solved)
self._testValidTransition(
[QuestionStatus.OPEN, QuestionStatus.NEEDSINFO,
@@ -538,7 +537,7 @@
# changes based on departure state.
def checkFAQ(message):
"""Check that the FAQ attribute was set correctly."""
- self.assertEquals(self.question.faq, self.faq)
+ self.assertEqual(self.question.faq, self.faq)
self._testValidTransition(
[QuestionStatus.OPEN, QuestionStatus.NEEDSINFO,
@@ -559,8 +558,8 @@
answers.
"""
checkFAQ(message)
- self.assertEquals(self.owner, self.question.answerer)
- self.assertEquals(message.datecreated, self.question.date_solved)
+ self.assertEqual(self.owner, self.question.answerer)
+ self.assertEqual(message.datecreated, self.question.date_solved)
self._testValidTransition(
[QuestionStatus.OPEN, QuestionStatus.NEEDSINFO,
@@ -642,9 +641,9 @@
def checkAnswerMessage(message):
# Check the attributes that are set when an answer is confirmed.
- self.assertEquals(answer_message, self.question.answer)
- self.assertEquals(self.answerer, self.question.answerer)
- self.assertEquals(message.datecreated, self.question.date_solved)
+ self.assertEqual(answer_message, self.question.answer)
+ self.assertEqual(self.answerer, self.question.answerer)
+ self.assertEqual(message.datecreated, self.question.date_solved)
self._testValidTransition(
[QuestionStatus.OPEN, QuestionStatus.NEEDSINFO,
@@ -672,13 +671,13 @@
self.question.giveAnswer(
self.owner, 'I solved my own problem.',
datecreated=self.nowPlus(2))
- self.assertEquals(self.question.status, QuestionStatus.SOLVED)
+ self.assertEqual(self.question.status, QuestionStatus.SOLVED)
def checkAnswerMessage(message):
# Check the attributes that are set when an answer is confirmed.
- self.assertEquals(answer_message, self.question.answer)
- self.assertEquals(self.answerer, self.question.answerer)
- self.assertEquals(message.datecreated, self.question.date_solved)
+ self.assertEqual(answer_message, self.question.answer)
+ self.assertEqual(self.answerer, self.question.answerer)
+ self.assertEqual(message.datecreated, self.question.date_solved)
self._testValidTransition(
[QuestionStatus.SOLVED],
@@ -765,7 +764,7 @@
self.question.giveAnswer(
self.owner, 'I solved my own problem.',
datecreated=self.nowPlus(0))
- self.assertEquals(self.question.status, QuestionStatus.SOLVED)
+ self.assertEqual(self.question.status, QuestionStatus.SOLVED)
# Clear previous events.
self.collected_events = []
@@ -793,7 +792,7 @@
self.answerer, 'Press the any key.', datecreated=self.nowPlus(0))
self.question.confirmAnswer("That answer worked!.",
answer=answer_message, datecreated=self.nowPlus(1))
- self.assertEquals(self.question.status, QuestionStatus.SOLVED)
+ self.assertEqual(self.question.status, QuestionStatus.SOLVED)
# Clear previous events.
self.collected_events = []
@@ -890,9 +889,9 @@
def checkRejectMessageIsAnAnswer(message):
# Check that the rejection message was considered answering
# the question.
- self.assertEquals(message, self.question.answer)
- self.assertEquals(self.answerer, self.question.answerer)
- self.assertEquals(message.datecreated, self.question.date_solved)
+ self.assertEqual(message, self.question.answer)
+ self.assertEqual(self.answerer, self.question.answerer)
+ self.assertEqual(message.datecreated, self.question.date_solved)
self._testValidTransition(
valid_statuses,
=== modified file 'lib/lp/app/browser/tests/test_inlineeditpickerwidget.py'
--- lib/lp/app/browser/tests/test_inlineeditpickerwidget.py 2015-07-08 16:05:11 +0000
+++ lib/lp/app/browser/tests/test_inlineeditpickerwidget.py 2018-01-02 16:24:23 +0000
@@ -42,7 +42,7 @@
# Make sure that when given a vocabulary which supports vocab filters,
# the vocab filters are include in the widget config.
widget = self.getWidget(vocabulary='ValidPersonOrTeam')
- self.assertEquals([
+ self.assertEqual([
{'name': 'ALL',
'title': 'All',
'description': 'Display all search results'},
@@ -87,13 +87,13 @@
# The widget has the correct meta value for a person value.
widget_value = self.factory.makePerson()
widget = self.getWidget(widget_value, vocabulary='ValidPersonOrTeam')
- self.assertEquals('person', widget.config['selected_value_metadata'])
+ self.assertEqual('person', widget.config['selected_value_metadata'])
def test_team_selected_value_meta(self):
# The widget has the correct meta value for a team value.
widget_value = self.factory.makeTeam()
widget = self.getWidget(widget_value, vocabulary='ValidPersonOrTeam')
- self.assertEquals('team', widget.config['selected_value_metadata'])
+ self.assertEqual('team', widget.config['selected_value_metadata'])
def test_required_fields_dont_have_a_remove_link(self):
widget = self.getWidget(
=== modified file 'lib/lp/app/browser/tests/test_launchpad.py'
--- lib/lp/app/browser/tests/test_launchpad.py 2016-06-20 22:29:24 +0000
+++ lib/lp/app/browser/tests/test_launchpad.py 2018-01-02 16:24:23 +0000
@@ -77,10 +77,10 @@
notifications = request.notifications
if notification is None:
- self.assertEquals(len(notifications), 0)
+ self.assertEqual(len(notifications), 0)
return
self.assertEqual(len(notifications), 1)
- self.assertEquals(notifications[0].level, level)
+ self.assertEqual(notifications[0].level, level)
self.assertEqual(notification, notifications[0].message)
def assertDisplaysNotification(
=== modified file 'lib/lp/app/browser/tests/test_launchpadroot.py'
--- lib/lp/app/browser/tests/test_launchpadroot.py 2018-01-02 10:54:31 +0000
+++ lib/lp/app/browser/tests/test_launchpadroot.py 2018-01-02 16:24:23 +0000
@@ -84,7 +84,7 @@
def test_featured_projects_view_requires_edit(self):
view = create_view(self.root, '+featuredprojects')
checker = selectChecker(view)
- self.assertEquals('launchpad.Edit', checker.permission_id('__call__'))
+ self.assertEqual('launchpad.Edit', checker.permission_id('__call__'))
def test_featured_projects_manage_link_requires_edit(self):
self.setUpRegistryExpert()
=== modified file 'lib/lp/app/tests/test_tales.py'
--- lib/lp/app/tests/test_tales.py 2018-01-02 10:54:31 +0000
+++ lib/lp/app/tests/test_tales.py 2018-01-02 16:24:23 +0000
@@ -395,7 +395,7 @@
ircID = ircset.new(person, "<b>irc.canonical.com</b>", "fred")
expected_html = test_tales(
'nick/fmt:formatted_displayname', nick=ircID)
- self.assertEquals(
+ self.assertEqual(
u'<strong>fred</strong>\n'
'<span class="lesser"> on </span>\n'
'<strong><b>irc.canonical.com</b></strong>\n',
=== modified file 'lib/lp/archivepublisher/tests/test_debversion.py'
--- lib/lp/archivepublisher/tests/test_debversion.py 2018-01-02 10:54:31 +0000
+++ lib/lp/archivepublisher/tests/test_debversion.py 2018-01-02 16:24:23 +0000
@@ -62,15 +62,15 @@
def testReturnString(self):
"""Version should convert to a string."""
- self.assertEquals(str(Version("1.0")), "1.0")
+ self.assertEqual(str(Version("1.0")), "1.0")
def testAcceptsInteger(self):
"""Version should accept an integer."""
- self.assertEquals(str(Version(1)), "1")
+ self.assertEqual(str(Version(1)), "1")
def testAcceptsNumber(self):
"""Version should accept a number."""
- self.assertEquals(str(Version(1.2)), "1.2")
+ self.assertEqual(str(Version(1.2)), "1.2")
def testNotEmpty(self):
"""Version should fail with empty input."""
@@ -107,8 +107,8 @@
def testRevisionNotEmpty(self):
"""Version should not allow an empty revision."""
v = Version("1-")
- self.assertEquals("1-", v.upstream_version)
- self.assertEquals(None, v.debian_version)
+ self.assertEqual("1-", v.upstream_version)
+ self.assertIsNone(v.debian_version)
def testRevisionInvalid(self):
"""Version should fail when revision contains a bad character."""
@@ -118,7 +118,7 @@
"""Version should give same input as output."""
for value in self.VALUES:
result = str(Version(value))
- self.assertEquals(value, result)
+ self.assertEqual(value, result)
def testComparisons(self):
"""Sample Version comparisons should pass."""
@@ -127,10 +127,10 @@
def testNullEpochIsZero(self):
"""Version should treat an omitted epoch as a zero one."""
- self.assertEquals(Version("1.0"), Version("0:1.0"))
+ self.assertEqual(Version("1.0"), Version("0:1.0"))
def notestNullRevisionIsZero(self):
"""Version should treat an omitted revision as being equal to zero.
"""
- self.assertEquals(Version("1.0"), Version("1.0-0"))
+ self.assertEqual(Version("1.0"), Version("1.0-0"))
self.assertTrue(Version("1.0") == Version("1.0-0"))
=== modified file 'lib/lp/archivepublisher/tests/test_htaccess.py'
--- lib/lp/archivepublisher/tests/test_htaccess.py 2017-10-09 11:33:11 +0000
+++ lib/lp/archivepublisher/tests/test_htaccess.py 2018-01-02 16:24:23 +0000
@@ -101,7 +101,7 @@
# If there are no ArchiveAuthTokens for an archive just
# the buildd secret is returned.
self.ppa.buildd_secret = "sekr1t"
- self.assertEquals(
+ self.assertEqual(
[("buildd", "sekr1t", "bu")],
list(htpasswd_credentials_for_archive(self.ppa)))
=== modified file 'lib/lp/archiveuploader/tests/test_changesfile.py'
--- lib/lp/archiveuploader/tests/test_changesfile.py 2017-09-17 10:35:57 +0000
+++ lib/lp/archiveuploader/tests/test_changesfile.py 2018-01-02 16:24:23 +0000
@@ -50,25 +50,25 @@
def testSourceFile(self):
# A non-DSC source file is a SourceUploadFile.
- self.assertEquals(
+ self.assertEqual(
('foo', SourceUploadFile),
determine_file_class_and_name('foo_1.0.diff.gz'))
def testDSCFile(self):
# A DSC is a DSCFile, since they're special.
- self.assertEquals(
+ self.assertEqual(
('foo', DSCFile),
determine_file_class_and_name('foo_1.0.dsc'))
def testDEBFile(self):
# A binary file is the appropriate PackageUploadFile subclass.
- self.assertEquals(
+ self.assertEqual(
('foo', DebBinaryUploadFile),
determine_file_class_and_name('foo_1.0_all.deb'))
- self.assertEquals(
+ self.assertEqual(
('foo', DdebBinaryUploadFile),
determine_file_class_and_name('foo_1.0_all.ddeb'))
- self.assertEquals(
+ self.assertEqual(
('foo', UdebBinaryUploadFile),
determine_file_class_and_name('foo_1.0_all.udeb'))
@@ -219,43 +219,43 @@
# checkFileName() yields an UploadError if the filename is invalid.
contents = self.getBaseChanges()
changes = self.createChangesFile("mypkg_0.1_i386.changes", contents)
- self.assertEquals([], list(changes.checkFileName()))
+ self.assertEqual([], list(changes.checkFileName()))
changes = self.createChangesFile("mypkg_0.1.changes", contents)
errors = list(changes.checkFileName())
self.assertIsInstance(errors[0], UploadError)
- self.assertEquals(1, len(errors))
+ self.assertEqual(1, len(errors))
def test_filename(self):
# Filename gets set to the basename of the changes file on disk.
changes = self.createChangesFile(
"mypkg_0.1_i386.changes", self.getBaseChanges())
- self.assertEquals("mypkg_0.1_i386.changes", changes.filename)
+ self.assertEqual("mypkg_0.1_i386.changes", changes.filename)
def test_suite_name(self):
# The suite name gets extracted from the changes file.
changes = self.createChangesFile(
"mypkg_0.1_i386.changes", self.getBaseChanges())
- self.assertEquals("nifty", changes.suite_name)
+ self.assertEqual("nifty", changes.suite_name)
def test_version(self):
# The version gets extracted from the changes file.
changes = self.createChangesFile(
"mypkg_0.1_i386.changes", self.getBaseChanges())
- self.assertEquals("0.1", changes.version)
+ self.assertEqual("0.1", changes.version)
def test_architectures(self):
# The architectures get extracted from the changes file
# and parsed correctly.
changes = self.createChangesFile(
"mypkg_0.1_i386.changes", self.getBaseChanges())
- self.assertEquals("i386", changes.architecture_line)
- self.assertEquals(set(["i386"]), changes.architectures)
+ self.assertEqual("i386", changes.architecture_line)
+ self.assertEqual(set(["i386"]), changes.architectures)
def test_source(self):
# The source package name gets extracted from the changes file.
changes = self.createChangesFile(
"mypkg_0.1_i386.changes", self.getBaseChanges())
- self.assertEquals("mypkg", changes.source)
+ self.assertEqual("mypkg", changes.source)
def test_processAddresses(self):
# processAddresses parses the changes file and sets the
@@ -263,9 +263,9 @@
contents = self.getBaseChanges()
changes = self.createChangesFile(
"mypkg_0.1_i386.changes", contents)
- self.assertEquals(None, changes.changed_by)
+ self.assertIsNone(changes.changed_by)
errors = list(changes.processAddresses())
- self.assertEquals(0, len(errors), "Errors: %r" % errors)
+ self.assertEqual(0, len(errors), "Errors: %r" % errors)
self.assertThat(
changes.changed_by,
MatchesDict({
@@ -280,8 +280,8 @@
contents = self.getBaseChanges()
changes = self.createChangesFile(
"mypkg_0.1_i386.changes", contents)
- self.assertEquals([], list(changes.processAddresses()))
- self.assertEquals(
+ self.assertEqual([], list(changes.processAddresses()))
+ self.assertEqual(
"Something changed\n\n"
" -- Somebody <somebody@xxxxxxxxxx> "
"Fri, 25 Jun 2010 11:20:22 -0600",
=== modified file 'lib/lp/archiveuploader/tests/test_dscfile.py'
--- lib/lp/archiveuploader/tests/test_dscfile.py 2016-06-01 01:59:32 +0000
+++ lib/lp/archiveuploader/tests/test_dscfile.py 2018-01-02 16:24:23 +0000
@@ -76,7 +76,7 @@
file.write(copyright)
file.close()
- self.assertEquals(
+ self.assertEqual(
copyright, find_copyright(self.tmpdir, DevNullLogger()))
def testBadDebianChangelog(self):
@@ -98,7 +98,7 @@
file.write(changelog)
file.close()
- self.assertEquals(
+ self.assertEqual(
changelog, find_changelog(self.tmpdir, DevNullLogger()))
def testOversizedFile(self):
@@ -252,7 +252,7 @@
DEBIAN_TARBALL: 0,
}
full_files.update(files)
- self.assertEquals(
+ self.assertEqual(
expected,
[str(e) for e in format_to_file_checker_map[self.format](
'foo_1.dsc', full_files, components, component_signatures,
@@ -408,7 +408,7 @@
unpacked_dir = unpack_source(
datadir(os.path.join('suite', 'bar_1.0-1', 'bar_1.0-1.dsc')))
try:
- self.assertEquals(["bar-1.0"], os.listdir(unpacked_dir))
+ self.assertEqual(["bar-1.0"], os.listdir(unpacked_dir))
self.assertContentEqual(
["THIS_IS_BAR", "debian"],
os.listdir(os.path.join(unpacked_dir, "bar-1.0")))
=== modified file 'lib/lp/archiveuploader/tests/test_nascentupload.py'
--- lib/lp/archiveuploader/tests/test_nascentupload.py 2014-06-11 08:29:40 +0000
+++ lib/lp/archiveuploader/tests/test_nascentupload.py 2018-01-02 16:24:23 +0000
@@ -52,7 +52,7 @@
return file
def assertMatchDDEBErrors(self, error_list):
- self.assertEquals(
+ self.assertEqual(
error_list, [str(e) for e in self.upload._matchDDEBs()])
def testNoLinksWithNoBinaries(self):
=== modified file 'lib/lp/archiveuploader/tests/test_nascentuploadfile.py'
--- lib/lp/archiveuploader/tests/test_nascentuploadfile.py 2016-11-17 16:46:04 +0000
+++ lib/lp/archiveuploader/tests/test_nascentuploadfile.py 2018-01-02 16:24:23 +0000
@@ -124,7 +124,7 @@
# The mime type gets set according to PackageUploadCustomFormat.
uploadfile = self.createCustomUploadFile(
"bla.txt", "data", "main/raw-installer", "extra")
- self.assertEquals(
+ self.assertEqual(
PackageUploadCustomFormat.DEBIAN_INSTALLER,
uploadfile.custom_type)
@@ -132,10 +132,10 @@
# storeInDatabase creates a library file.
uploadfile = self.createCustomUploadFile(
"bla.txt", "data", "main/raw-installer", "extra")
- self.assertEquals("application/octet-stream", uploadfile.content_type)
+ self.assertEqual("application/octet-stream", uploadfile.content_type)
libraryfile = uploadfile.storeInDatabase()
- self.assertEquals("bla.txt", libraryfile.filename)
- self.assertEquals("application/octet-stream", libraryfile.mimetype)
+ self.assertEqual("bla.txt", libraryfile.filename)
+ self.assertEqual("application/octet-stream", libraryfile.mimetype)
def test_debian_installer_verify(self):
# debian-installer uploads are required to have sensible filenames.
@@ -236,7 +236,7 @@
priority_name, package, version, changes):
(path, md5, sha1, size) = self.writeUploadFile(filename, dsc.dump())
if changes:
- self.assertEquals([], list(changes.processAddresses()))
+ self.assertEqual([], list(changes.processAddresses()))
return DSCFile(
path, dict(MD5=md5), size, component_and_section, priority_name,
package, version, changes, self.policy, self.logger)
@@ -246,7 +246,7 @@
dsc = self.getBaseDsc()
uploadfile = self.createDSCFile(
"foo.dsc", dsc, "main/net", "extra", "dulwich", "0.42", None)
- self.assertEquals(
+ self.assertEqual(
"text/x-debian-source-package", uploadfile.content_type)
def test_storeInDatabase(self):
@@ -260,8 +260,8 @@
uploadfile.changelog = "DUMMY"
uploadfile.files = []
release = uploadfile.storeInDatabase(None)
- self.assertEquals("0.42", release.version)
- self.assertEquals("dpkg, bzr", release.builddepends)
+ self.assertEqual("0.42", release.version)
+ self.assertEqual("dpkg, bzr", release.builddepends)
def test_storeInDatabase_case_sensitivity(self):
# storeInDatabase supports field names with different cases,
@@ -275,7 +275,7 @@
uploadfile.files = []
uploadfile.changelog = "DUMMY"
release = uploadfile.storeInDatabase(None)
- self.assertEquals("dpkg, bzr", release.builddepends)
+ self.assertEqual("dpkg, bzr", release.builddepends)
def test_user_defined_fields(self):
# storeInDatabase updates user_defined_fields.
@@ -289,7 +289,7 @@
uploadfile.files = []
release = uploadfile.storeInDatabase(None)
# DSCFile lowercases the field names
- self.assertEquals(
+ self.assertEqual(
[["Python-Version", u"2.5"]], release.user_defined_fields)
def test_homepage(self):
@@ -303,7 +303,7 @@
uploadfile.changelog = "DUMMY"
uploadfile.files = []
release = uploadfile.storeInDatabase(None)
- self.assertEquals(u"http://samba.org/~jelmer/bzr", release.homepage)
+ self.assertEqual(u"http://samba.org/~jelmer/bzr", release.homepage)
def test_checkBuild(self):
# checkBuild() verifies consistency with a build.
@@ -320,7 +320,7 @@
uploadfile.checkBuild(build)
# checkBuild() sets the build status to FULLYBUILT and
# removes the upload log.
- self.assertEquals(BuildStatus.FULLYBUILT, build.status)
+ self.assertEqual(BuildStatus.FULLYBUILT, build.status)
self.assertIs(None, build.upload_log)
def test_checkBuild_inconsistent(self):
@@ -399,7 +399,7 @@
# Unknown priorities automatically get changed to 'extra'.
uploadfile = self.createDebBinaryUploadFile(
"foo_0.42_i386.deb", "main/net", "unknown", "mypkg", "0.42", None)
- self.assertEquals("extra", uploadfile.priority_name)
+ self.assertEqual("extra", uploadfile.priority_name)
def test_parseControl(self):
# parseControl sets various fields on DebBinaryUploadFile.
@@ -408,10 +408,10 @@
None)
control = self.getBaseControl()
uploadfile.parseControl(control)
- self.assertEquals("python", uploadfile.section_name)
- self.assertEquals("dulwich", uploadfile.source_name)
- self.assertEquals("0.42", uploadfile.source_version)
- self.assertEquals("0.42", uploadfile.control_version)
+ self.assertEqual("python", uploadfile.section_name)
+ self.assertEqual("dulwich", uploadfile.source_name)
+ self.assertEqual("0.42", uploadfile.source_version)
+ self.assertEqual("0.42", uploadfile.control_version)
def test_verifyFormat_control_xz(self):
# verifyFormat accepts .debs with an xz-compressed control member.
@@ -452,15 +452,15 @@
uploadfile.parseControl(control)
build = self.factory.makeBinaryPackageBuild()
bpr = uploadfile.storeInDatabase(build)
- self.assertEquals(u'python (<< 2.7), python (>= 2.5)', bpr.depends)
- self.assertEquals(
+ self.assertEqual(u'python (<< 2.7), python (>= 2.5)', bpr.depends)
+ self.assertEqual(
u"Dulwich is a Python implementation of the file formats "
u"and protocols", bpr.description)
- self.assertEquals(False, bpr.essential)
- self.assertEquals(524, bpr.installedsize)
- self.assertEquals(True, bpr.architecturespecific)
- self.assertEquals(u"", bpr.recommends)
- self.assertEquals("0.42", bpr.version)
+ self.assertEqual(False, bpr.essential)
+ self.assertEqual(524, bpr.installedsize)
+ self.assertEqual(True, bpr.architecturespecific)
+ self.assertEqual(u"", bpr.recommends)
+ self.assertEqual("0.42", bpr.version)
def test_user_defined_fields(self):
# storeInDatabase stores user defined fields.
@@ -472,7 +472,7 @@
uploadfile.parseControl(control)
build = self.factory.makeBinaryPackageBuild()
bpr = uploadfile.storeInDatabase(build)
- self.assertEquals(
+ self.assertEqual(
[[u"Python-Version", u"2.5"]], bpr.user_defined_fields)
def test_user_defined_fields_newlines(self):
@@ -485,7 +485,7 @@
uploadfile.parseControl(control)
build = self.factory.makeBinaryPackageBuild()
bpr = uploadfile.storeInDatabase(build)
- self.assertEquals(
+ self.assertEqual(
[
[u"RandomData", u"Foo\nbar\nbla\n"],
], bpr.user_defined_fields)
@@ -500,7 +500,7 @@
uploadfile.parseControl(control)
build = self.factory.makeBinaryPackageBuild()
bpr = uploadfile.storeInDatabase(build)
- self.assertEquals(
+ self.assertEqual(
u"http://samba.org/~jelmer/dulwich", bpr.homepage)
def test_checkBuild(self):
@@ -516,7 +516,7 @@
uploadfile.checkBuild(build)
# checkBuild() sets the build status to FULLYBUILT and
# removes the upload log.
- self.assertEquals(BuildStatus.FULLYBUILT, build.status)
+ self.assertEqual(BuildStatus.FULLYBUILT, build.status)
self.assertIs(None, build.upload_log)
def test_checkBuild_inconsistent(self):
@@ -549,7 +549,7 @@
control = self.getBaseControl()
control["Source"] = "foo"
uploadfile.parseControl(control)
- self.assertEquals(
+ self.assertEqual(
spph.sourcepackagerelease, uploadfile.findSourcePackageRelease())
def test_findSourcePackageRelease_no_spph(self):
@@ -594,5 +594,5 @@
control = self.getBaseControl()
control["Source"] = "foo"
uploadfile.parseControl(control)
- self.assertEquals(
+ self.assertEqual(
spph2.sourcepackagerelease, uploadfile.findSourcePackageRelease())
=== modified file 'lib/lp/archiveuploader/tests/test_ppauploadprocessor.py'
--- lib/lp/archiveuploader/tests/test_ppauploadprocessor.py 2016-07-02 07:55:26 +0000
+++ lib/lp/archiveuploader/tests/test_ppauploadprocessor.py 2018-01-02 16:24:23 +0000
@@ -1146,7 +1146,7 @@
# primary archive.
upload_dir = self.queueUpload(
"bar_1.0-2_3.0-quilt_without_orig", "~name16/ubuntu")
- self.assertEquals(
+ self.assertEqual(
self.processUpload(self.uploadprocessor, upload_dir),
['accepted'])
=== modified file 'lib/lp/archiveuploader/tests/test_recipeuploads.py'
--- lib/lp/archiveuploader/tests/test_recipeuploads.py 2015-04-20 15:59:52 +0000
+++ lib/lp/archiveuploader/tests/test_recipeuploads.py 2018-01-02 16:24:23 +0000
@@ -60,7 +60,7 @@
'%d/ubuntu/bar_1.0-1_source.changes' % self.build.archive.id)
self.layer.txn.commit()
- self.assertEquals(UploadStatusEnum.ACCEPTED, result,
+ self.assertEqual(UploadStatusEnum.ACCEPTED, result,
"Source upload failed\nGot: %s" % self.log.getLogBuffer())
self.assertEqual(BuildStatus.FULLYBUILT, self.build.status)
=== modified file 'lib/lp/archiveuploader/tests/test_uploadpolicy.py'
--- lib/lp/archiveuploader/tests/test_uploadpolicy.py 2017-05-02 23:02:41 +0000
+++ lib/lp/archiveuploader/tests/test_uploadpolicy.py 2018-01-02 16:24:23 +0000
@@ -70,7 +70,7 @@
policy.validateUploadType(upload)
- self.assertEquals([], upload.rejections)
+ self.assertEqual([], upload.rejections)
def test_binaryful_accepted(self):
policy = make_policy(accepted_type=ArchiveUploadType.BINARY_ONLY)
@@ -78,7 +78,7 @@
policy.validateUploadType(upload)
- self.assertEquals([], upload.rejections)
+ self.assertEqual([], upload.rejections)
def test_mixed_accepted(self):
policy = make_policy(accepted_type=ArchiveUploadType.MIXED_ONLY)
@@ -86,7 +86,7 @@
policy.validateUploadType(upload)
- self.assertEquals([], upload.rejections)
+ self.assertEqual([], upload.rejections)
def test_sourceful_not_accepted(self):
policy = make_policy(accepted_type=ArchiveUploadType.BINARY_ONLY)
=== modified file 'lib/lp/archiveuploader/tests/test_uploadprocessor.py'
--- lib/lp/archiveuploader/tests/test_uploadprocessor.py 2017-09-17 10:35:57 +0000
+++ lib/lp/archiveuploader/tests/test_uploadprocessor.py 2018-01-02 16:24:23 +0000
@@ -1778,7 +1778,7 @@
"rejected" in str(msg), "Failed to upload bar source:\n%s" % msg)
spph = self.publishPackage("bar", "1.0-1")
- self.assertEquals(
+ self.assertEqual(
sorted((sprf.libraryfile.filename, sprf.filetype)
for sprf in spph.sourcepackagerelease.files),
[('bar_1.0-1.debian.tar.bz2',
@@ -1819,11 +1819,11 @@
# Upload another source sharing the same (component) orig.
upload_dir = self.queueUpload("bar_1.0-2_3.0-quilt_without_orig")
- self.assertEquals(
+ self.assertEqual(
self.processUpload(uploadprocessor, upload_dir), ['accepted'])
queue_item = uploadprocessor.last_processed_upload.queue_root
- self.assertEquals(
+ self.assertEqual(
sorted((sprf.libraryfile.filename, sprf.filetype) for sprf
in queue_item.sources[0].sourcepackagerelease.files),
[('bar_1.0-2.debian.tar.bz2',
@@ -1859,7 +1859,7 @@
"rejected" in str(msg), "Failed to upload bar source:\n%s" % msg)
spph = self.publishPackage("bar", "1.0")
- self.assertEquals(
+ self.assertEqual(
sorted((sprf.libraryfile.filename, sprf.filetype)
for sprf in spph.sourcepackagerelease.files),
[('bar_1.0.dsc',
@@ -2194,10 +2194,9 @@
self.options.builds = True
BuildUploadHandler(self.uploadprocessor, self.incoming_folder,
leaf_name).process()
- self.assertEquals(1, len(self.oopses))
- self.assertEquals(
- BuildStatus.FAILEDTOUPLOAD, build.status)
- self.assertEquals(builder, build.builder)
+ self.assertEqual(1, len(self.oopses))
+ self.assertEqual(BuildStatus.FAILEDTOUPLOAD, build.status)
+ self.assertEqual(builder, build.builder)
self.assertIsNot(None, build.duration)
log_contents = build.upload_log.read()
self.assertTrue('ERROR Exception while processing upload '
@@ -2254,7 +2253,7 @@
build = self.factory.makeSourcePackageRecipeBuild(sourcename=u"bar",
distroseries=self.breezy, archive=archive,
requester=archive.owner)
- self.assertEquals(archive.owner, build.requester)
+ self.assertEqual(archive.owner, build.requester)
self.switchToUploader()
# Commit so the build cookie has the right ids.
self.layer.txn.commit()
@@ -2279,8 +2278,8 @@
# Properly uploaded source packages should result in the
# build status changing to FULLYBUILT.
build = self.doSuccessRecipeBuild()
- self.assertEquals(BuildStatus.FULLYBUILT, build.status)
- self.assertEquals(None, build.builder)
+ self.assertEqual(BuildStatus.FULLYBUILT, build.status)
+ self.assertIsNone(build.builder)
self.assertIsNot(None, build.duration)
# Upon full build the upload log is unset.
self.assertIs(None, build.upload_log)
@@ -2319,8 +2318,8 @@
def testSourcePackageRecipeBuild_fail(self):
build = self.doFailureRecipeBuild()
- self.assertEquals(BuildStatus.FAILEDTOUPLOAD, build.status)
- self.assertEquals(None, build.builder)
+ self.assertEqual(BuildStatus.FAILEDTOUPLOAD, build.status)
+ self.assertIsNone(build.builder)
self.assertIsNot(None, build.duration)
self.assertIsNot(None, build.upload_log)
@@ -2366,8 +2365,8 @@
def testSourcePackageRecipeBuild_deleted_recipe(self):
build = self.doDeletedRecipeBuild()
- self.assertEquals(BuildStatus.FAILEDTOUPLOAD, build.status)
- self.assertEquals(None, build.builder)
+ self.assertEqual(BuildStatus.FAILEDTOUPLOAD, build.status)
+ self.assertIsNone(build.builder)
self.assertIsNot(None, build.duration)
self.assertIs(None, build.upload_log)
@@ -2437,7 +2436,7 @@
# The build status is not changed
self.assertTrue(
os.path.exists(os.path.join(self.incoming_folder, leaf_name)))
- self.assertEquals(BuildStatus.BUILDING, build.status)
+ self.assertEqual(BuildStatus.BUILDING, build.status)
self.assertLogContains("Build status is BUILDING. Ignoring.")
def testBuildWithInvalidStatus(self):
@@ -2451,7 +2450,7 @@
os.path.exists(os.path.join(self.incoming_folder, leaf_name)))
self.assertTrue(
os.path.exists(os.path.join(self.failed_folder, leaf_name)))
- self.assertEquals(BuildStatus.NEEDSBUILD, build.status)
+ self.assertEqual(BuildStatus.NEEDSBUILD, build.status)
self.assertLogContains(
"Expected build status to be UPLOADING or BUILDING, was "
"NEEDSBUILD.")
@@ -2486,7 +2485,7 @@
"""Tests for parse_build_upload_leaf_name."""
def test_valid(self):
- self.assertEquals(
+ self.assertEqual(
('PACKAGEBUILD', 60),
parse_build_upload_leaf_name("20100812-PACKAGEBUILD-60"))
=== modified file 'lib/lp/archiveuploader/tests/test_utils.py'
--- lib/lp/archiveuploader/tests/test_utils.py 2016-06-01 01:59:32 +0000
+++ lib/lp/archiveuploader/tests/test_utils.py 2018-01-02 16:24:23 +0000
@@ -30,116 +30,116 @@
"""lp.archiveuploader.utils.determine_source_file_type should work."""
# .dsc -> DSC
- self.assertEquals(
+ self.assertEqual(
determine_source_file_type('foo_1.0-1.dsc'),
SourcePackageFileType.DSC)
# .diff.gz -> DIFF
- self.assertEquals(
+ self.assertEqual(
determine_source_file_type('foo_1.0-1.diff.gz'),
SourcePackageFileType.DIFF)
# DIFFs can only be gzipped.
- self.assertEquals(
+ self.assertEqual(
determine_source_file_type('foo_1.0.diff.bz2'), None)
# Plain original tarballs can be gzipped or bzip2ed.
- self.assertEquals(
+ self.assertEqual(
determine_source_file_type('foo_1.0.orig.tar.gz'),
SourcePackageFileType.ORIG_TARBALL)
- self.assertEquals(
+ self.assertEqual(
determine_source_file_type('foo_1.0.orig.tar.bz2'),
SourcePackageFileType.ORIG_TARBALL)
- self.assertEquals(
+ self.assertEqual(
determine_source_file_type('foo_1.0.orig.tar.xz'),
SourcePackageFileType.ORIG_TARBALL)
# Component original tarballs too.
- self.assertEquals(
+ self.assertEqual(
determine_source_file_type('foo_1.0.orig-foo.tar.gz'),
SourcePackageFileType.COMPONENT_ORIG_TARBALL)
- self.assertEquals(
+ self.assertEqual(
determine_source_file_type('foo_1.0.orig-bar.tar.bz2'),
SourcePackageFileType.COMPONENT_ORIG_TARBALL)
- self.assertEquals(
+ self.assertEqual(
determine_source_file_type('foo_1.0.orig-bar.tar.xz'),
SourcePackageFileType.COMPONENT_ORIG_TARBALL)
# And Debian tarballs...
- self.assertEquals(
+ self.assertEqual(
determine_source_file_type('foo_1.0-1.debian.tar.gz'),
SourcePackageFileType.DEBIAN_TARBALL)
- self.assertEquals(
+ self.assertEqual(
determine_source_file_type('foo_1.0-2.debian.tar.bz2'),
SourcePackageFileType.DEBIAN_TARBALL)
- self.assertEquals(
+ self.assertEqual(
determine_source_file_type('foo_1.0-2.debian.tar.xz'),
SourcePackageFileType.DEBIAN_TARBALL)
# And even native tarballs!
- self.assertEquals(
+ self.assertEqual(
determine_source_file_type('foo_1.0.tar.gz'),
SourcePackageFileType.NATIVE_TARBALL)
- self.assertEquals(
+ self.assertEqual(
determine_source_file_type('foo_1.0.tar.bz2'),
SourcePackageFileType.NATIVE_TARBALL)
- self.assertEquals(
+ self.assertEqual(
determine_source_file_type('foo_1.0.tar.xz'),
SourcePackageFileType.NATIVE_TARBALL)
# (Component) original tarball signatures are detected for any
# supported compression method.
- self.assertEquals(
+ self.assertEqual(
determine_source_file_type('foo_1.0.orig.tar.gz.asc'),
SourcePackageFileType.ORIG_TARBALL_SIGNATURE)
- self.assertEquals(
+ self.assertEqual(
determine_source_file_type('foo_1.0.orig.tar.bz2.asc'),
SourcePackageFileType.ORIG_TARBALL_SIGNATURE)
- self.assertEquals(
+ self.assertEqual(
determine_source_file_type('foo_1.0.orig.tar.xz.asc'),
SourcePackageFileType.ORIG_TARBALL_SIGNATURE)
- self.assertEquals(
+ self.assertEqual(
determine_source_file_type('foo_1.0.orig-foo.tar.gz.asc'),
SourcePackageFileType.COMPONENT_ORIG_TARBALL_SIGNATURE)
- self.assertEquals(
+ self.assertEqual(
determine_source_file_type('foo_1.0.orig-bar.tar.bz2.asc'),
SourcePackageFileType.COMPONENT_ORIG_TARBALL_SIGNATURE)
- self.assertEquals(
+ self.assertEqual(
determine_source_file_type('foo_1.0.orig-bar.tar.xz.asc'),
SourcePackageFileType.COMPONENT_ORIG_TARBALL_SIGNATURE)
- self.assertEquals(None, determine_source_file_type('foo_1.0'))
- self.assertEquals(None, determine_source_file_type('foo_1.0.blah.gz'))
+ self.assertIsNone(determine_source_file_type('foo_1.0'))
+ self.assertIsNone(determine_source_file_type('foo_1.0.blah.gz'))
def test_determine_binary_file_type(self):
"""lp.archiveuploader.utils.determine_binary_file_type should work."""
# .deb -> DEB
- self.assertEquals(
+ self.assertEqual(
determine_binary_file_type('foo_1.0-1_all.deb'),
BinaryPackageFileType.DEB)
# .ddeb -> DDEB
- self.assertEquals(
+ self.assertEqual(
determine_binary_file_type('foo_1.0-1_all.ddeb'),
BinaryPackageFileType.DDEB)
# .udeb -> UDEB
- self.assertEquals(
+ self.assertEqual(
determine_binary_file_type('foo_1.0-1_all.udeb'),
BinaryPackageFileType.UDEB)
- self.assertEquals(determine_binary_file_type('foo_1.0'), None)
- self.assertEquals(determine_binary_file_type('foo_1.0.notdeb'), None)
+ self.assertEqual(determine_binary_file_type('foo_1.0'), None)
+ self.assertEqual(determine_binary_file_type('foo_1.0.notdeb'), None)
def testPrefixMultilineString(self):
"""lp.archiveuploader.utils.prefix_multi_line_string should work"""
from lp.archiveuploader.utils import prefix_multi_line_string
- self.assertEquals("A:foo\nA:bar",
- prefix_multi_line_string("foo\nbar", "A:"))
- self.assertEquals("A:foo\nA:bar",
- prefix_multi_line_string("foo\n\nbar", "A:"))
- self.assertEquals("A:foo\nA:\nA:bar",
- prefix_multi_line_string("foo\n\nbar", "A:", 1))
+ self.assertEqual("A:foo\nA:bar",
+ prefix_multi_line_string("foo\nbar", "A:"))
+ self.assertEqual("A:foo\nA:bar",
+ prefix_multi_line_string("foo\n\nbar", "A:"))
+ self.assertEqual("A:foo\nA:\nA:bar",
+ prefix_multi_line_string("foo\n\nbar", "A:", 1))
def testExtractComponent(self):
"""lp.archiveuploader.utils.extract_component_from_section should work
@@ -147,21 +147,21 @@
from lp.archiveuploader.utils import extract_component_from_section
(sect, comp) = extract_component_from_section("libs")
- self.assertEquals(sect, "libs")
- self.assertEquals(comp, "main")
+ self.assertEqual(sect, "libs")
+ self.assertEqual(comp, "main")
(sect, comp) = extract_component_from_section("restricted/libs")
- self.assertEquals(sect, "libs")
- self.assertEquals(comp, "restricted")
+ self.assertEqual(sect, "libs")
+ self.assertEqual(comp, "restricted")
(sect, comp) = extract_component_from_section("libs", "multiverse")
- self.assertEquals(sect, "libs")
- self.assertEquals(comp, "multiverse")
+ self.assertEqual(sect, "libs")
+ self.assertEqual(comp, "multiverse")
(sect, comp) = extract_component_from_section("restricted/libs",
"multiverse")
- self.assertEquals(sect, "libs")
- self.assertEquals(comp, "restricted")
+ self.assertEqual(sect, "libs")
+ self.assertEqual(comp, "restricted")
def testParseMaintainerOkay(self):
"""lp.archiveuploader.utils.parse_maintainer should parse correctly
@@ -224,9 +224,9 @@
for case in cases:
(name, email) = parse_maintainer_bytes(case[0], 'Maintainer')
- self.assertEquals(case[2], name)
- self.assertEquals(case[3], email)
- self.assertEquals(case[1], rfc822_encode_address(name, email))
+ self.assertEqual(case[2], name)
+ self.assertEqual(case[3], email)
+ self.assertEqual(case[1], rfc822_encode_address(name, email))
def testParseMaintainerRaises(self):
"""lp.archiveuploader.utils.parse_maintainer should raise on incorrect
@@ -251,7 +251,7 @@
def test_re_isadeb(self):
# Verify that the three binary extensions match the regexp.
for extension in ('deb', 'ddeb', 'udeb'):
- self.assertEquals(
+ self.assertEqual(
('foo-bar', '1.0', 'i386', extension),
re_isadeb.match('foo-bar_1.0_i386.%s' % extension).groups())
@@ -270,13 +270,13 @@
'orig-foo_bar.tar.gz',
'debian.tar.gz', 'debian.tar.bz2', 'debian.tar.xz')
for extension in extensions:
- self.assertEquals(
+ self.assertEqual(
('foo-bar', '1.0', extension),
re_issource.match('foo-bar_1.0.%s' % extension).groups())
# While orig-*.tar.gz is all interpreted as extension, *orig-*.tar.gz
# is taken to have an extension of just 'tar.gz'.
- self.assertEquals(
+ self.assertEqual(
('foo-bar', '1.0.porig-bar', 'tar.gz'),
re_issource.match('foo-bar_1.0.porig-bar.tar.gz').groups())
@@ -301,7 +301,7 @@
extract_dpkg_source(
datadir(os.path.join('suite', 'bar_1.0-1', 'bar_1.0-1.dsc')),
temp_dir)
- self.assertEquals(["bar-1.0"], os.listdir(temp_dir))
+ self.assertEqual(["bar-1.0"], os.listdir(temp_dir))
self.assertContentEqual(
["THIS_IS_BAR", "debian"],
os.listdir(os.path.join(temp_dir, "bar-1.0")))
@@ -311,4 +311,4 @@
err = self.assertRaises(
DpkgSourceError, extract_dpkg_source,
"thispathdoesntexist", temp_dir)
- self.assertEquals(2, err.result)
+ self.assertEqual(2, err.result)
=== modified file 'lib/lp/blueprints/browser/tests/test_breadcrumbs.py'
--- lib/lp/blueprints/browser/tests/test_breadcrumbs.py 2017-10-25 13:10:41 +0000
+++ lib/lp/blueprints/browser/tests/test_breadcrumbs.py 2018-01-02 16:24:23 +0000
@@ -27,15 +27,15 @@
crumbs = self.getBreadcrumbsForObject(
self.product, rootsite='blueprints')
last_crumb = crumbs[-1]
- self.assertEquals(last_crumb.url, self.product_specs_url)
- self.assertEquals(last_crumb.text, 'Blueprints')
+ self.assertEqual(last_crumb.url, self.product_specs_url)
+ self.assertEqual(last_crumb.text, 'Blueprints')
def test_person(self):
crumbs = self.getBreadcrumbsForObject(
self.person, rootsite='blueprints')
last_crumb = crumbs[-1]
- self.assertEquals(last_crumb.url, self.person_specs_url)
- self.assertEquals(last_crumb.text, 'Blueprints')
+ self.assertEqual(last_crumb.url, self.person_specs_url)
+ self.assertEqual(last_crumb.text, 'Blueprints')
class TestSpecificationBreadcrumb(BaseBreadcrumbTestCase):
@@ -53,6 +53,5 @@
def test_specification(self):
crumbs = self.getBreadcrumbsForObject(self.specification)
last_crumb = crumbs[-1]
- self.assertEquals(last_crumb.url, self.specification_url)
- self.assertEquals(
- last_crumb.text, self.specification.title)
+ self.assertEqual(last_crumb.url, self.specification_url)
+ self.assertEqual(last_crumb.text, self.specification.title)
=== modified file 'lib/lp/blueprints/model/tests/test_specification.py'
--- lib/lp/blueprints/model/tests/test_specification.py 2017-10-25 13:10:41 +0000
+++ lib/lp/blueprints/model/tests/test_specification.py 2018-01-02 16:24:23 +0000
@@ -495,7 +495,7 @@
assignee=None, milestone=milestone)
# We start with no work items.
- self.assertEquals([], list(spec.work_items))
+ self.assertEqual([], list(spec.work_items))
login_person(spec.owner)
spec.updateWorkItems([work_item1_data, work_item2_data])
=== modified file 'lib/lp/bugs/adapters/tests/test_bugchange.py'
--- lib/lp/bugs/adapters/tests/test_bugchange.py 2012-03-13 00:45:33 +0000
+++ lib/lp/bugs/adapters/tests/test_bugchange.py 2018-01-02 16:24:23 +0000
@@ -71,8 +71,7 @@
change = list(get_bug_changes(bug_delta))[0]
self.assertTrue(isinstance(change, BugDescriptionChange))
- self.assertEquals(
- BugNotificationLevel.METADATA, change.change_level)
+ self.assertEqual(BugNotificationLevel.METADATA, change.change_level)
def test_change_level_lifecycle_status_closing(self):
# Changing a bug task status from NEW to FIXRELEASED makes this
@@ -87,8 +86,7 @@
bugtask_deltas=bugtask_delta)
change = list(get_bug_changes(bug_delta))[0]
- self.assertEquals(
- BugNotificationLevel.LIFECYCLE, change.change_level)
+ self.assertEqual(BugNotificationLevel.LIFECYCLE, change.change_level)
def test_change_level_lifecycle_status_reopening(self):
# Changing a bug task status from FIXRELEASED to TRIAGED makes this
@@ -103,9 +101,7 @@
bugtask_deltas=bugtask_delta)
change = list(get_bug_changes(bug_delta))[0]
- self.assertEquals(
- BugNotificationLevel.LIFECYCLE,
- change.change_level)
+ self.assertEqual(BugNotificationLevel.LIFECYCLE, change.change_level)
def test_change_level_metadata_status_worked_on(self):
# Changing a bug task status from TRIAGED to FIXCOMMITTED makes this
@@ -120,8 +116,7 @@
bugtask_deltas=bugtask_delta)
change = list(get_bug_changes(bug_delta))[0]
- self.assertEquals(
- BugNotificationLevel.METADATA, change.change_level)
+ self.assertEqual(BugNotificationLevel.METADATA, change.change_level)
def test_change_level_metadata_status_stays_closed(self):
# Changing a bug task status from OPINION to WONTFIX makes this
@@ -136,8 +131,7 @@
bugtask_deltas=bugtask_delta)
change = list(get_bug_changes(bug_delta))[0]
- self.assertEquals(
- BugNotificationLevel.METADATA, change.change_level)
+ self.assertEqual(BugNotificationLevel.METADATA, change.change_level)
def test_change_level_metadata_duplicate_of_unresolved(self):
# Marking a bug as a duplicate of an unresolved bug is a
@@ -153,8 +147,7 @@
})
change = list(get_bug_changes(bug_delta))[0]
- self.assertEquals(
- BugNotificationLevel.METADATA, change.change_level)
+ self.assertEqual(BugNotificationLevel.METADATA, change.change_level)
def test_change_level_lifecycle_duplicate_of_resolved(self):
# Marking a bug as a duplicate of a resolved bug is
@@ -170,8 +163,7 @@
})
change = list(get_bug_changes(bug_delta))[0]
- self.assertEquals(
- BugNotificationLevel.LIFECYCLE, change.change_level)
+ self.assertEqual(BugNotificationLevel.LIFECYCLE, change.change_level)
def test_change_level_metadata_not_duplicate_of_unresolved(self):
# Un-marking a bug as a duplicate of an unresolved bug is a
@@ -187,8 +179,7 @@
})
change = list(get_bug_changes(bug_delta))[0]
- self.assertEquals(
- BugNotificationLevel.METADATA, change.change_level)
+ self.assertEqual(BugNotificationLevel.METADATA, change.change_level)
def test_change_level_lifecycle_not_duplicate_of_resolved(self):
# Un-marking a bug as a duplicate of a resolved bug is
@@ -203,5 +194,4 @@
'old': duplicate_of})
change = list(get_bug_changes(bug_delta))[0]
- self.assertEquals(
- BugNotificationLevel.LIFECYCLE, change.change_level)
+ self.assertEqual(BugNotificationLevel.LIFECYCLE, change.change_level)
=== modified file 'lib/lp/bugs/browser/tests/test_breadcrumbs.py'
--- lib/lp/bugs/browser/tests/test_breadcrumbs.py 2014-02-19 00:35:25 +0000
+++ lib/lp/bugs/browser/tests/test_breadcrumbs.py 2018-01-02 16:24:23 +0000
@@ -24,17 +24,17 @@
def test_bugtask(self):
crumbs = self.getBreadcrumbsForObject(self.bugtask)
last_crumb = crumbs[-1]
- self.assertEquals(self.bugtask_url, last_crumb.url)
- self.assertEquals("Bug #%d" % self.bug.id, last_crumb.text)
- self.assertEquals(
+ self.assertEqual(self.bugtask_url, last_crumb.url)
+ self.assertEqual("Bug #%d" % self.bug.id, last_crumb.text)
+ self.assertEqual(
u"Bug #%d \u201cborked\u201d" % self.bug.id, last_crumb.detail)
def test_bugtask_child(self):
crumbs = self.getBreadcrumbsForObject(
self.bugtask, view_name='+activity')
- self.assertEquals(crumbs[-1].url, "%s/+activity" % self.bugtask_url)
- self.assertEquals(crumbs[-2].url, self.bugtask_url)
- self.assertEquals(crumbs[-2].text, "Bug #%d" % self.bug.id)
+ self.assertEqual(crumbs[-1].url, "%s/+activity" % self.bugtask_url)
+ self.assertEqual(crumbs[-2].url, self.bugtask_url)
+ self.assertEqual(crumbs[-2].text, "Bug #%d" % self.bug.id)
def test_bugtask_comment(self):
login_person(self.bug.owner)
@@ -88,13 +88,13 @@
person_bugs_url = canonical_url(person, rootsite='bugs')
crumbs = self.getBreadcrumbsForObject(person, rootsite='bugs')
last_crumb = crumbs[-1]
- self.assertEquals(person_bugs_url, last_crumb.url)
- self.assertEquals("Bugs", last_crumb.text)
+ self.assertEqual(person_bugs_url, last_crumb.url)
+ self.assertEqual("Bugs", last_crumb.text)
def test_bugtarget(self):
project = self.factory.makeProduct(name='fnord')
project_bugs_url = canonical_url(project, rootsite='bugs')
crumbs = self.getBreadcrumbsForObject(project, rootsite='bugs')
last_crumb = crumbs[-1]
- self.assertEquals(project_bugs_url, last_crumb.url)
- self.assertEquals("Bugs", last_crumb.text)
+ self.assertEqual(project_bugs_url, last_crumb.url)
+ self.assertEqual("Bugs", last_crumb.text)
=== modified file 'lib/lp/bugs/browser/tests/test_bug_views.py'
--- lib/lp/bugs/browser/tests/test_bug_views.py 2017-10-21 18:14:14 +0000
+++ lib/lp/bugs/browser/tests/test_bug_views.py 2018-01-02 16:24:23 +0000
@@ -654,7 +654,7 @@
view = create_initialized_view(
bug.default_bugtask, '+addcomment', form=form)
expected_error = u'Either a comment or attachment must be provided.'
- self.assertEquals(view.errors[0], expected_error)
+ self.assertEqual(view.errors[0], expected_error)
def test_whitespaces_message_with_attached_file(self):
# If the message only contains whitespaces but a file
=== modified file 'lib/lp/bugs/browser/tests/test_bugnomination.py'
--- lib/lp/bugs/browser/tests/test_bugnomination.py 2016-10-05 08:44:13 +0000
+++ lib/lp/bugs/browser/tests/test_bugnomination.py 2018-01-02 16:24:23 +0000
@@ -243,7 +243,7 @@
return view
def assertApproves(self, nomination):
- self.assertEquals(
+ self.assertEqual(
302,
self.getNominationEditView(
nomination,
=== modified file 'lib/lp/bugs/browser/tests/test_bugtask.py'
--- lib/lp/bugs/browser/tests/test_bugtask.py 2018-01-02 10:54:31 +0000
+++ lib/lp/bugs/browser/tests/test_bugtask.py 2018-01-02 16:24:23 +0000
@@ -1751,7 +1751,7 @@
self.setAttribute(
task, 'assignee',
self.factory.makePerson(displayname="Foo &<>", name='foo'))
- self.assertEquals(
+ self.assertEqual(
"nobody → Foo &<> (foo)",
BugActivityItem(task.bug.activity[-1]).change_details)
@@ -1759,7 +1759,7 @@
with celebrity_logged_in('admin'):
bug = self.factory.makeBug(title="foo")
self.setAttribute(bug, 'title', "bar &<>")
- self.assertEquals(
+ self.assertEqual(
"- foo<br />+ bar &<>",
BugActivityItem(bug.activity[-1]).change_details)
=== modified file 'lib/lp/bugs/browser/tests/test_expose.py'
--- lib/lp/bugs/browser/tests/test_expose.py 2015-09-09 16:47:34 +0000
+++ lib/lp/bugs/browser/tests/test_expose.py 2018-01-02 16:24:23 +0000
@@ -249,7 +249,7 @@
expose_user_administered_teams_to_js(self.request, self.user, context,
absoluteURL=fake_absoluteURL)
team_info = self.request.objects['administratedTeams']
- self.assertEquals(len(team_info), 0)
+ self.assertEqual(len(team_info), 0)
def test_teams_for_distro_with_bug_super(self):
self._setup_teams(self.user)
=== modified file 'lib/lp/bugs/mail/tests/test_handler.py'
--- lib/lp/bugs/mail/tests/test_handler.py 2016-03-23 17:55:39 +0000
+++ lib/lp/bugs/mail/tests/test_handler.py 2018-01-02 16:24:23 +0000
@@ -98,7 +98,7 @@
# NB SignedMessage by default isn't actually signed, it just has the
# capability of knowing about signing.
message = self.factory.makeSignedMessage(body=' affects malone\nhi!')
- self.assertEquals(message.signature, None)
+ self.assertEqual(message.signature, None)
# Pretend that the mail auth has given us a logged-in user.
handler = MaloneHandler()
@@ -106,8 +106,8 @@
mail_handled, add_comment_to_bug, commands = \
handler.extractAndAuthenticateCommands(message,
'new@xxxxxxxxxxxxxxxxxx')
- self.assertEquals(mail_handled, None)
- self.assertEquals(map(str, commands), [
+ self.assertEqual(mail_handled, None)
+ self.assertEqual(map(str, commands), [
'bug new',
'affects malone',
])
=== modified file 'lib/lp/bugs/model/tests/test_bugtask.py'
--- lib/lp/bugs/model/tests/test_bugtask.py 2017-05-08 11:38:20 +0000
+++ lib/lp/bugs/model/tests/test_bugtask.py 2018-01-02 16:24:23 +0000
@@ -729,7 +729,7 @@
names = set(
name for interface in providedBy(delta) for name in interface)
for name in names:
- self.assertEquals(getattr(delta, name), expected_delta.get(name))
+ self.assertEqual(getattr(delta, name), expected_delta.get(name))
def test_get_bugwatch_delta(self):
# Exercise getDelta() with a change to bugwatch.
@@ -1199,8 +1199,8 @@
# Get a debbugs watch.
watch_debbugs_327452 = bugwatchset.get(9)
- self.assertEquals(watch_debbugs_327452.bugtracker.name, "debbugs")
- self.assertEquals(watch_debbugs_327452.remotebug, "327452")
+ self.assertEqual(watch_debbugs_327452.bugtracker.name, "debbugs")
+ self.assertEqual(watch_debbugs_327452.remotebug, "327452")
# Associate the watch to a Fix Released task.
debian = getUtility(IDistributionSet).getByName("debian")
@@ -2208,7 +2208,7 @@
def test_distribution_to_package_works(self):
distro = self.factory.makeDistribution()
dsp = self.factory.makeDistributionSourcePackage(distribution=distro)
- self.assertEquals(dsp.distribution, distro)
+ self.assertEqual(dsp.distribution, distro)
self.assertTransitionWorks(distro, dsp)
def test_package_to_package_works(self):
=== modified file 'lib/lp/bugs/scripts/checkwatches/tests/test_core.py'
--- lib/lp/bugs/scripts/checkwatches/tests/test_core.py 2018-01-02 10:54:31 +0000
+++ lib/lp/bugs/scripts/checkwatches/tests/test_core.py 2018-01-02 16:24:23 +0000
@@ -244,7 +244,7 @@
transaction.commit()
master._updateBugTracker(bug_tracker)
for bug_watch in bug_watches:
- self.assertEquals(
+ self.assertEqual(
BugWatchActivityStatus.CONNECTION_ERROR,
bug_watch.last_error_type)
self.assertEqual(
@@ -264,7 +264,7 @@
transaction.commit()
master._updateBugTracker(bug_tracker)
for bug_watch in bug_watches:
- self.assertEquals(
+ self.assertEqual(
BugWatchActivityStatus.UNKNOWN,
bug_watch.last_error_type)
self.assertEqual(
=== modified file 'lib/lp/bugs/scripts/tests/test_bugnotification.py'
--- lib/lp/bugs/scripts/tests/test_bugnotification.py 2015-08-06 12:09:28 +0000
+++ lib/lp/bugs/scripts/tests/test_bugnotification.py 2018-01-02 16:24:23 +0000
@@ -439,20 +439,20 @@
def test_with_nothing(self):
# Nothing is generated if an empty list is passed in.
- self.assertEquals([], list(notification_comment_batches([])))
+ self.assertEqual([], list(notification_comment_batches([])))
def test_with_one_non_comment_notification(self):
# Given a single non-comment notification, a single tuple is
# generated.
notification = FakeNotification(False)
- self.assertEquals(
+ self.assertEqual(
[(1, notification)],
list(notification_comment_batches([notification])))
def test_with_one_comment_notification(self):
# Given a single comment notification, a single tuple is generated.
notification = FakeNotification(True)
- self.assertEquals(
+ self.assertEqual(
[(1, notification)],
list(notification_comment_batches([notification])))
@@ -462,7 +462,7 @@
notification1 = FakeNotification(True)
notification2 = FakeNotification(False)
notifications = [notification1, notification2]
- self.assertEquals(
+ self.assertEqual(
[(1, notification1), (1, notification2)],
list(notification_comment_batches(notifications)))
@@ -472,7 +472,7 @@
notification1 = FakeNotification(False)
notification2 = FakeNotification(True)
notifications = [notification1, notification2]
- self.assertEquals(
+ self.assertEqual(
[(1, notification1), (1, notification2)],
list(notification_comment_batches(notifications)))
@@ -483,7 +483,7 @@
notification2 = FakeNotification(True)
notification3 = FakeNotification(False)
notifications = [notification1, notification2, notification3]
- self.assertEquals(
+ self.assertEqual(
[(1, notification1), (1, notification2), (1, notification3)],
list(notification_comment_batches(notifications)))
@@ -500,7 +500,7 @@
notification1, notification2,
notification3, notification4,
]
- self.assertEquals(
+ self.assertEqual(
[(1, notification1), (1, notification2),
(1, notification3), (2, notification4)],
list(notification_comment_batches(notifications)))
@@ -511,20 +511,20 @@
def test_with_nothing(self):
# Nothing is generated if an empty list is passed in.
- self.assertEquals([], list(notification_batches([])))
+ self.assertEqual([], list(notification_batches([])))
def test_with_one_non_comment_notification(self):
# Given a single non-comment notification, a single batch is
# generated.
notification = FakeNotification(False)
- self.assertEquals(
+ self.assertEqual(
[[notification]],
list(notification_batches([notification])))
def test_with_one_comment_notification(self):
# Given a single comment notification, a single batch is generated.
notification = FakeNotification(True)
- self.assertEquals(
+ self.assertEqual(
[[notification]],
list(notification_batches([notification])))
@@ -534,7 +534,7 @@
notification1 = FakeNotification(True)
notification2 = FakeNotification(False)
notifications = [notification1, notification2]
- self.assertEquals(
+ self.assertEqual(
[[notification1, notification2]],
list(notification_batches(notifications)))
@@ -544,7 +544,7 @@
notification1 = FakeNotification(False)
notification2 = FakeNotification(True)
notifications = [notification1, notification2]
- self.assertEquals(
+ self.assertEqual(
[[notification1, notification2]],
list(notification_batches(notifications)))
@@ -555,7 +555,7 @@
notification2 = FakeNotification(True)
notification3 = FakeNotification(False)
notifications = [notification1, notification2, notification3]
- self.assertEquals(
+ self.assertEqual(
[[notification1, notification2, notification3]],
list(notification_batches(notifications)))
@@ -571,7 +571,7 @@
notification1, notification2,
notification3, notification4,
]
- self.assertEquals(
+ self.assertEqual(
[[notification1, notification2, notification3], [notification4]],
list(notification_batches(notifications)))
@@ -579,20 +579,20 @@
# Batches are grouped by bug.
notifications = [FakeNotification(bug=1) for number in range(5)]
observed = list(notification_batches(notifications))
- self.assertEquals([notifications], observed)
+ self.assertEqual([notifications], observed)
def test_notifications_for_different_bugs(self):
# Batches are grouped by bug.
notifications = [FakeNotification(bug=number) for number in range(5)]
expected = [[notification] for notification in notifications]
observed = list(notification_batches(notifications))
- self.assertEquals(expected, observed)
+ self.assertEqual(expected, observed)
def test_notifications_for_same_owner(self):
# Batches are grouped by owner.
notifications = [FakeNotification(owner=1) for number in range(5)]
observed = list(notification_batches(notifications))
- self.assertEquals([notifications], observed)
+ self.assertEqual([notifications], observed)
def test_notifications_for_different_owners(self):
# Batches are grouped by owner.
@@ -600,7 +600,7 @@
FakeNotification(owner=number) for number in range(5)]
expected = [[notification] for notification in notifications]
observed = list(notification_batches(notifications))
- self.assertEquals(expected, observed)
+ self.assertEqual(expected, observed)
def test_notifications_with_mixed_bugs_and_owners(self):
# Batches are grouped by bug and owner.
@@ -612,7 +612,7 @@
]
expected = [[notification] for notification in notifications]
observed = list(notification_batches(notifications))
- self.assertEquals(expected, observed)
+ self.assertEqual(expected, observed)
def test_notifications_with_mixed_bugs_and_owners_2(self):
# Batches are grouped by bug and owner.
@@ -624,7 +624,7 @@
]
expected = [notifications[0:2], notifications[2:4]]
observed = list(notification_batches(notifications))
- self.assertEquals(expected, observed)
+ self.assertEqual(expected, observed)
def test_notifications_with_mixed_bugs_owners_and_comments(self):
# Batches are grouped by bug, owner and comments.
@@ -636,7 +636,7 @@
]
expected = [notifications[0:3], notifications[3:4]]
observed = list(notification_batches(notifications))
- self.assertEquals(expected, observed)
+ self.assertEqual(expected, observed)
class EmailNotificationTestBase(TestCaseWithFactory):
@@ -1122,7 +1122,7 @@
self.addFilter(u"Test filter")
the_subscriber = self.subscription.subscriber
- self.assertEquals(
+ self.assertEqual(
{other_person.preferredemail.email: [u"Someone's filter"],
the_subscriber.preferredemail.email: [u"Test filter"]},
self.getSubscriptionEmailHeaders(by_person=True))
=== modified file 'lib/lp/buildmaster/browser/tests/test_processor.py'
--- lib/lp/buildmaster/browser/tests/test_processor.py 2015-04-20 11:07:41 +0000
+++ lib/lp/buildmaster/browser/tests/test_processor.py 2018-01-02 16:24:23 +0000
@@ -16,7 +16,7 @@
def test_processor_url(self):
quantum = self.factory.makeProcessor('quantum')
- self.assertEquals(
+ self.assertEqual(
'/+processors/quantum',
canonical_url(quantum, force_local_path=True))
@@ -24,4 +24,4 @@
quantum = self.factory.makeProcessor('quantum')
obj, view, request = test_traverse(
'http://api.launchpad.dev/devel/+processors/quantum')
- self.assertEquals(quantum, obj)
+ self.assertEqual(quantum, obj)
=== modified file 'lib/lp/buildmaster/tests/test_buildfarmjobbehaviour.py'
--- lib/lp/buildmaster/tests/test_buildfarmjobbehaviour.py 2016-06-01 15:13:12 +0000
+++ lib/lp/buildmaster/tests/test_buildfarmjobbehaviour.py 2018-01-02 16:24:23 +0000
@@ -269,7 +269,7 @@
result=True)
def assertResultCount(self, count, result):
- self.assertEquals(
+ self.assertEqual(
1, len(os.listdir(os.path.join(self.upload_root, result))))
@defer.inlineCallbacks
=== modified file 'lib/lp/buildmaster/tests/test_processor.py'
--- lib/lp/buildmaster/tests/test_processor.py 2015-04-20 11:07:41 +0000
+++ lib/lp/buildmaster/tests/test_processor.py 2018-01-02 16:24:23 +0000
@@ -27,7 +27,7 @@
def test_getByName(self):
processor_set = getUtility(IProcessorSet)
q1 = self.factory.makeProcessor(name='q1')
- self.assertEquals(q1, processor_set.getByName('q1'))
+ self.assertEqual(q1, processor_set.getByName('q1'))
def test_getByName_not_found(self):
processor_set = getUtility(IProcessorSet)
@@ -42,7 +42,7 @@
self.factory.makeProcessor(name='q1')
self.factory.makeProcessor(name='i686')
self.factory.makeProcessor(name='g4')
- self.assertEquals(
+ self.assertEqual(
['g4', 'i686', 'q1'],
sorted(
processor.name for processor in processor_set.getAll()
@@ -68,7 +68,7 @@
processor = self.webservice.named_get(
'/+processors', 'getByName', name='transmeta',
api_version='devel').jsonBody()
- self.assertEquals('transmeta', processor['name'])
+ self.assertEqual('transmeta', processor['name'])
def test_default_collection(self):
# Make it easy to filter out sample data
@@ -82,7 +82,7 @@
collection = self.webservice.get(
'/+processors?ws.size=10', api_version='devel').jsonBody()
- self.assertEquals(
+ self.assertEqual(
['g4', 'i686', 'q1'],
sorted(
processor['name'] for processor in collection['entries']
=== modified file 'lib/lp/buildmaster/tests/test_queuedepth.py'
--- lib/lp/buildmaster/tests/test_queuedepth.py 2015-05-14 08:50:41 +0000
+++ lib/lp/buildmaster/tests/test_queuedepth.py 2018-01-02 16:24:23 +0000
@@ -75,7 +75,7 @@
time_stamp = job.date_started or datetime.now(utc)
estimate = job.getEstimatedJobStartTime(now=time_stamp)
if delay_in_seconds is None:
- test.assertEquals(
+ test.assertEqual(
delay_in_seconds, estimate,
"An estimate should not be possible at present but one was "
"returned (%s) nevertheless." % estimate)
@@ -509,7 +509,7 @@
builder.builderok = False
# No builders capable of running the job at hand are available now.
- self.assertEquals(0, builders_for_job(apg_job))
+ self.assertEqual(0, builders_for_job(apg_job))
# The "minimum time to builder" estimation logic is not aware of this
# though.
check_mintime_to_builder(self, apg_job, 0)
@@ -526,7 +526,7 @@
# All native builders are disabled now. No builders capable of
# running the job at hand are available.
- self.assertEquals(0, builders_for_job(job))
+ self.assertEqual(0, builders_for_job(job))
# The "minimum time to builder" estimation logic is not aware of the
# fact that no builders capable of running the job are available.
check_mintime_to_builder(self, job, 0)
@@ -678,7 +678,7 @@
builder.builderok = False
# No builders capable of running the job at hand are available now.
- self.assertEquals(0, builders_for_job(apg_job))
+ self.assertEqual(0, builders_for_job(apg_job))
check_mintime_to_builder(self, apg_job, 0)
# Let's add a processor-independent job to the mix.
@@ -687,7 +687,7 @@
sourcename='my-recipe-digikam', score=9999)
# There are still builders available for the processor-independent
# job.
- self.assertEquals(6, builders_for_job(job))
+ self.assertEqual(6, builders_for_job(job))
# Even free ones.
self.assertTrue(
bq._getFreeBuildersCount(job.processor, job.virtualized) > 0,
@@ -702,7 +702,7 @@
# There are no builders capable of running even the processor
# independent jobs now.
- self.assertEquals(0, builders_for_job(job))
+ self.assertEqual(0, builders_for_job(job))
check_mintime_to_builder(self, job, 0)
# Re-enable the native hppa builders.
@@ -840,9 +840,9 @@
check_delay_for_job(self, zsh_job, 0)
# Assign the zsh job to a builder.
- self.assertEquals((None, False), bash_job._getHeadJobPlatform())
+ self.assertEqual((None, False), bash_job._getHeadJobPlatform())
assign_to_builder(self, 'xx-recipe-zsh', 1, None)
- self.assertEquals((1, False), bash_job._getHeadJobPlatform())
+ self.assertEqual((1, False), bash_job._getHeadJobPlatform())
# Now that the highest-scored job is out of the way, the estimation
# for the 'bash' recipe build is 222 seconds shorter.
@@ -858,7 +858,7 @@
# Also, the platform of the postgres job is returned since it *is*
# the head job now.
pg_platform = (postgres_job.processor.id, postgres_job.virtualized)
- self.assertEquals(pg_platform, postgres_job._getHeadJobPlatform())
+ self.assertEqual(pg_platform, postgres_job._getHeadJobPlatform())
class TestJobDispatchTimeEstimation(MultiArchBuildsBase):
@@ -948,7 +948,7 @@
# processor-independent jobs:
# (12:56 + 11:05 + 18:30 + 16:38 + 14:47 + 9:14)/6 = 831
check_estimate(self, gcc_job, 1671)
- self.assertEquals(5, builders_for_job(gcc_job))
+ self.assertEqual(5, builders_for_job(gcc_job))
def test_proc_indep_virtual_true(self):
xxr_build, xxr_job = find_job(self, 'xxr-apt-build', None)
@@ -1029,8 +1029,8 @@
# processor-independent jobs :
# (12:56 + 11:05 + 18:30 + 16:38 + 14:47)/5 = 887
# waiting time for next builder: = 120
- self.assertEquals(2, builders_for_job(vim_job))
- self.assertEquals(9, builders_for_job(xxr_job))
+ self.assertEqual(2, builders_for_job(vim_job))
+ self.assertEqual(9, builders_for_job(xxr_job))
check_estimate(self, vim_job, 2747)
def test_estimation_binary_virtual_headjob(self):
=== modified file 'lib/lp/buildmaster/tests/test_webservice.py'
--- lib/lp/buildmaster/tests/test_webservice.py 2015-09-29 01:38:34 +0000
+++ lib/lp/buildmaster/tests/test_webservice.py 2018-01-02 16:24:23 +0000
@@ -79,7 +79,7 @@
logout()
results = self.webservice.named_get(
'/builders', 'getBuildQueueSizes', api_version='devel')
- self.assertEquals(
+ self.assertEqual(
['nonvirt', 'virt'], sorted(results.jsonBody().keys()))
def test_getBuildersForQueue(self):
@@ -99,7 +99,7 @@
'/builders', 'getBuildersForQueue',
processor=api_url(quantum), virtualized=True,
api_version='devel').jsonBody()
- self.assertEquals(
+ self.assertEqual(
['quantum_builder1', 'quantum_builder2'],
sorted(builder['name'] for builder in results['entries']))
=== modified file 'lib/lp/code/browser/tests/test_branch.py'
--- lib/lp/code/browser/tests/test_branch.py 2017-11-10 11:28:43 +0000
+++ lib/lp/code/browser/tests/test_branch.py 2018-01-02 16:24:23 +0000
@@ -1046,7 +1046,7 @@
browser.contents,
Contains('Public branches are not allowed for target Commercial.'))
with person_logged_in(owner):
- self.assertEquals(initial_target, branch.target.context)
+ self.assertEqual(initial_target, branch.target.context)
def test_information_type_in_ui(self):
# The information_type of a branch can be changed via the UI by an
=== modified file 'lib/lp/code/browser/tests/test_sourcepackagerecipe.py'
--- lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2017-10-21 18:14:14 +0000
+++ lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2018-01-02 16:24:23 +0000
@@ -443,7 +443,7 @@
self.makeBranchAndPackage(), '+new-recipe', user=self.chef)
# The options for the owner include the Good Chefs team.
options = browser.getControl(name='field.owner.owner').displayOptions
- self.assertEquals(
+ self.assertEqual(
['Good Chefs (good-chefs)', 'Master Chef (chef)'],
sorted([str(option) for option in options]))
=== modified file 'lib/lp/code/model/tests/test_branch.py'
--- lib/lp/code/model/tests/test_branch.py 2017-11-06 09:32:45 +0000
+++ lib/lp/code/model/tests/test_branch.py 2018-01-02 16:24:23 +0000
@@ -1240,8 +1240,8 @@
branch_id = self.branch.id
branch_set = getUtility(IBranchLookup)
self.branch.destroySelf()
- self.assert_(branch_set.get(branch_id) is None,
- "The branch has not been deleted.")
+ self.assertIsNone(
+ branch_set.get(branch_id), "The branch has not been deleted.")
def test_stackedBranchDisablesDeletion(self):
# A branch that is stacked upon cannot be deleted.
=== modified file 'lib/lp/code/model/tests/test_branchmergeproposal.py'
--- lib/lp/code/model/tests/test_branchmergeproposal.py 2017-11-24 17:22:34 +0000
+++ lib/lp/code/model/tests/test_branchmergeproposal.py 2018-01-02 16:24:23 +0000
@@ -2354,13 +2354,13 @@
self.factory.makeRevisionsForBranch(bmp.source_branch, count=5)
r1 = bmp.source_branch.getBranchRevision(sequence=1)
initial_revisions = list(bmp.getUnlandedSourceBranchRevisions())
- self.assertEquals(5, len(initial_revisions))
+ self.assertEqual(5, len(initial_revisions))
self.assertIn(r1, initial_revisions)
# If we push one of the revisions into the target, it disappears
# from the unlanded list.
bmp.target_branch.createBranchRevision(1, r1.revision)
partial_revisions = list(bmp.getUnlandedSourceBranchRevisions())
- self.assertEquals(4, len(partial_revisions))
+ self.assertEqual(4, len(partial_revisions))
self.assertNotIn(r1, partial_revisions)
=== modified file 'lib/lp/code/model/tests/test_codeimportjob.py'
--- lib/lp/code/model/tests/test_codeimportjob.py 2017-10-04 01:53:48 +0000
+++ lib/lp/code/model/tests/test_codeimportjob.py 2018-01-02 16:24:23 +0000
@@ -137,7 +137,7 @@
"""Assert that the expected job is chosen by getJobForMachine."""
observed_job = getUtility(ICodeImportJobSet).getJobForMachine(
self.machine.hostname, worker_limit=10)
- self.assert_(observed_job is not None, "No job was selected.")
+ self.assertIsNotNone(observed_job, "No job was selected.")
self.assertEqual(desired_job, observed_job,
"Expected job not selected.")
@@ -145,7 +145,7 @@
"""Assert that no job is selected."""
observed_job = getUtility(ICodeImportJobSet).getJobForMachine(
'machine', worker_limit=10)
- self.assert_(observed_job is None, "Job unexpectedly selected.")
+ self.assertIsNone(observed_job, "Job unexpectedly selected.")
def test_nothingSelectedIfNothingCreated(self):
# There are no due jobs pending if we don't create any (this
@@ -775,7 +775,7 @@
getUtility(ICodeImportJobWorkflow).finishJob(
running_job, CodeImportResultStatus.SUCCESS, None)
new_job = code_import.import_job
- self.assert_(new_job is not None)
+ self.assertIsNotNone(new_job)
self.assertEqual(new_job.state, CodeImportJobState.PENDING)
self.assertEqual(new_job.machine, None)
self.assertEqual(
@@ -791,7 +791,7 @@
getUtility(ICodeImportJobWorkflow).finishJob(
running_job, CodeImportResultStatus.SUCCESS_PARTIAL, None)
new_job = code_import.import_job
- self.assert_(new_job is not None)
+ self.assertIsNotNone(new_job)
self.assertEqual(new_job.state, CodeImportJobState.PENDING)
self.assertEqual(new_job.machine, None)
self.assertSqlAttributeEqualsDate(new_job, 'date_due', UTC_NOW)
=== modified file 'lib/lp/code/model/tests/test_recipebuilder.py'
--- lib/lp/code/model/tests/test_recipebuilder.py 2017-10-04 01:53:48 +0000
+++ lib/lp/code/model/tests/test_recipebuilder.py 2018-01-02 16:24:23 +0000
@@ -128,7 +128,7 @@
job.setBuilder(builder, OkSlave())
logger = BufferLogger()
job.verifyBuildRequest(logger)
- self.assertEquals("", logger.getLogBuffer())
+ self.assertEqual("", logger.getLogBuffer())
def test_verifyBuildRequest_non_virtual(self):
# verifyBuildRequest will raise if a non-virtual builder is proposed.
=== modified file 'lib/lp/code/model/tests/test_revision.py'
--- lib/lp/code/model/tests/test_revision.py 2017-10-04 01:49:22 +0000
+++ lib/lp/code/model/tests/test_revision.py 2018-01-02 16:24:23 +0000
@@ -215,7 +215,7 @@
# IRevisionSet.getByRevisionId returns the revision with that id.
revision = self.factory.makeRevision()
found = self.revision_set.getByRevisionId(revision.revision_id)
- self.assertEquals(revision, found)
+ self.assertEqual(revision, found)
def test_getRevisionById_nonexistent(self):
# IRevisionSet.getByRevisionId returns None if there is no revision
=== modified file 'lib/lp/code/model/tests/test_sourcepackagerecipebuild.py'
--- lib/lp/code/model/tests/test_sourcepackagerecipebuild.py 2017-10-04 01:53:48 +0000
+++ lib/lp/code/model/tests/test_sourcepackagerecipebuild.py 2018-01-02 16:24:23 +0000
@@ -356,9 +356,9 @@
date_created=datetime.now(utc) - timedelta(hours=24, seconds=1),
status=BuildStatus.FULLYBUILT)
daily_builds = SourcePackageRecipeBuild.makeDailyBuilds()
- self.assertEquals(1, len(daily_builds))
+ self.assertEqual(1, len(daily_builds))
actual_title = [b.title for b in daily_builds]
- self.assertEquals([build.title], actual_title)
+ self.assertEqual([build.title], actual_title)
def test_makeDailyBuilds_with_an_older_and_newer_build(self):
# If a recipe has been built twice, and the most recent build is
@@ -374,7 +374,7 @@
date_created=datetime.now(utc) - timediff,
status=BuildStatus.FULLYBUILT)
daily_builds = SourcePackageRecipeBuild.makeDailyBuilds()
- self.assertEquals([], list(daily_builds))
+ self.assertEqual([], list(daily_builds))
def test_makeDailyBuilds_with_new_build_different_archive(self):
# If a recipe has been built into an archive that isn't the
@@ -390,7 +390,7 @@
status=BuildStatus.FULLYBUILT)
daily_builds = SourcePackageRecipeBuild.makeDailyBuilds()
actual_title = [b.title for b in daily_builds]
- self.assertEquals([build.title], actual_title)
+ self.assertEqual([build.title], actual_title)
def test_makeDailyBuilds_with_disallowed_series(self):
# If a recipe is set to build into a disallowed series,
@@ -402,7 +402,7 @@
distroseries = list(recipe.distroseries)[0]
removeSecurityProxy(distroseries).status = SeriesStatus.OBSOLETE
SourcePackageRecipeBuild.makeDailyBuilds(logger)
- self.assertEquals([], self.oopses)
+ self.assertEqual([], self.oopses)
self.assertIn(
"DEBUG - cannot build against Warty (4.10).",
logger.getLogBuffer())
@@ -452,7 +452,7 @@
def test_getUploader(self):
# For ACL purposes the uploader is the build requester.
build = self.makeSourcePackageRecipeBuild()
- self.assertEquals(build.requester,
+ self.assertEqual(build.requester,
build.getUploader(None))
def test_getByBuildFarmJob(self):
@@ -497,7 +497,7 @@
build.updateStatus(BuildStatus.FULLYBUILT)
IStore(build).flush()
build.notify()
- self.assertEquals(0, len(pop_notifications()))
+ self.assertEqual(0, len(pop_notifications()))
def test_notify_when_recipe_deleted(self):
"""Notify does nothing if recipe has been deleted."""
@@ -516,4 +516,4 @@
IStore(build).flush()
build.notify()
notifications = pop_notifications()
- self.assertEquals(0, len(notifications))
+ self.assertEqual(0, len(notifications))
=== modified file 'lib/lp/code/tests/test_branch_webservice.py'
--- lib/lp/code/tests/test_branch_webservice.py 2017-10-04 01:53:48 +0000
+++ lib/lp/code/tests/test_branch_webservice.py 2018-01-02 16:24:23 +0000
@@ -114,7 +114,7 @@
target_branch=target, initial_comment='Merge\nit!',
needs_review=True, commit_message='It was merged!\n',
reviewers=[source.owner.self_link], review_types=[])
- self.assertEquals(
+ self.assertEqual(
exception.content,
'reviewers and review_types must be equal length.')
@@ -148,7 +148,7 @@
BadRequest, source.createMergeProposal,
target_branch=source, initial_comment='Merge\nit!',
needs_review=True, commit_message='It was merged!\n')
- self.assertEquals(
+ self.assertEqual(
exception.content,
'Source and target branches must be different.')
=== modified file 'lib/lp/code/tests/test_bzr.py'
--- lib/lp/code/tests/test_bzr.py 2017-10-04 01:49:22 +0000
+++ lib/lp/code/tests/test_bzr.py 2018-01-02 16:24:23 +0000
@@ -85,7 +85,7 @@
def test_empty(self):
branch = self.make_branch('test')
- self.assertEquals([], branch_revision_history(branch))
+ self.assertEqual([], branch_revision_history(branch))
def test_some_commits(self):
branch = self.make_branch('test')
@@ -93,7 +93,7 @@
tree.commit('acommit', rev_id=b'A')
tree.commit('bcommit', rev_id=b'B')
tree.commit('ccommit', rev_id=b'C')
- self.assertEquals(
+ self.assertEqual(
[b'A', b'B', b'C'], branch_revision_history(tree.branch))
=== modified file 'lib/lp/code/xmlrpc/tests/test_codehosting.py'
--- lib/lp/code/xmlrpc/tests/test_codehosting.py 2016-12-31 05:01:10 +0000
+++ lib/lp/code/xmlrpc/tests/test_codehosting.py 2018-01-02 16:24:23 +0000
@@ -258,7 +258,7 @@
self.assertUnmirrored(branch)
branch.requestMirror()
- self.assertEquals(
+ self.assertEqual(
branch.id, self.codehosting_api.acquireBranchToPull([])[0])
failure_message = self.factory.getUniqueString()
=== modified file 'lib/lp/codehosting/codeimport/tests/test_worker.py'
--- lib/lp/codehosting/codeimport/tests/test_worker.py 2017-01-12 18:01:56 +0000
+++ lib/lp/codehosting/codeimport/tests/test_worker.py 2018-01-02 16:24:23 +0000
@@ -253,7 +253,7 @@
target_url = store._getMirrorURL(self.arbitrary_branch_id)
knit_format = format_registry.get('knit')()
tree = create_branch_with_one_revision(target_url, format=knit_format)
- self.assertNotEquals(
+ self.assertNotEqual(
tree.bzrdir._format.repository_format.network_name(),
default_format.repository_format.network_name())
@@ -261,8 +261,8 @@
new_branch = store.pull(
self.arbitrary_branch_id, self.temp_dir, default_format)
# Make sure backup.bzr is removed, as it interferes with CSCVS.
- self.assertEquals(os.listdir(self.temp_dir), [".bzr"])
- self.assertEquals(new_branch.repository._format.network_name(),
+ self.assertEqual(os.listdir(self.temp_dir), [".bzr"])
+ self.assertEqual(new_branch.repository._format.network_name(),
default_format.repository_format.network_name())
def test_pushUpgradesFormat(self):
@@ -292,13 +292,13 @@
# Only .bzr is left behind. The scanner removes branches
# in which invalid directories (such as .bzr.retire.
# exist). (bug #798560)
- self.assertEquals(
+ self.assertEqual(
target_branch.user_transport.list_dir("."),
[".bzr"])
self.assertEqual(
default_format.get_branch_format(),
target_branch._format)
- self.assertEquals(
+ self.assertEqual(
target_branch.last_revision_info(),
new_branch.last_revision_info())
@@ -461,7 +461,7 @@
store = ImportDataStore(transport, source_details)
local_name = '%s.tar.gz' % (self.factory.getUniqueString('tarball'),)
store.fetch(local_name)
- self.assertEquals(content, open(local_name).read())
+ self.assertEqual(content, open(local_name).read())
def test_fetch_with_dest_transport(self):
# The second, optional, argument to fetch is the transport in which to
@@ -478,7 +478,7 @@
self.get_transport(local_prefix).ensure_base()
local_name = '%s.tar.gz' % (self.factory.getUniqueString(),)
store.fetch(local_name, self.get_transport(local_prefix))
- self.assertEquals(
+ self.assertEqual(
content, open(os.path.join(local_prefix, local_name)).read())
def test_put_copiesFileToTransport(self):
@@ -494,7 +494,7 @@
# That the remote name is like this is part of the interface of
# ImportDataStore.
remote_name = '%08x.tar.gz' % (source_details.target_id,)
- self.assertEquals(content, transport.get_bytes(remote_name))
+ self.assertEqual(content, transport.get_bytes(remote_name))
def test_put_ensures_base(self):
# Put ensures that the directory pointed to by the transport exists.
@@ -522,7 +522,7 @@
# That the remote name is like this is part of the interface of
# ImportDataStore.
remote_name = '%08x.tar.gz' % (source_details.target_id,)
- self.assertEquals(content, transport.get_bytes(remote_name))
+ self.assertEqual(content, transport.get_bytes(remote_name))
class MockForeignWorkingTree:
@@ -1110,7 +1110,7 @@
# There should only be one revision there, the other
# one is in the stacked-on repository.
self.addCleanup(stacked_on.lock_read().unlock)
- self.assertEquals(
+ self.assertEqual(
base_rev_count,
len(stacked_on.repository.revisions.keys()))
worker = self.makeImportWorker(
@@ -1120,15 +1120,15 @@
self.assertEqual(
CodeImportWorkerExitCode.SUCCESS, worker.run())
branch = self.getStoredBazaarBranch(worker)
- self.assertEquals(
+ self.assertEqual(
base_rev_count,
len(stacked_on.repository.revisions.keys()))
# There should only be one revision there, the other
# one is in the stacked-on repository.
self.addCleanup(branch.lock_read().unlock)
- self.assertEquals(1,
+ self.assertEqual(1,
len(branch.repository.revisions.without_fallbacks().keys()))
- self.assertEquals(stacked_on.base, branch.get_stacked_on_url())
+ self.assertEqual(stacked_on.base, branch.get_stacked_on_url())
class TestGitImport(WorkerTest, TestActualImportMixin,
@@ -1197,7 +1197,7 @@
source_details.url = urlutils.join_segment_parameters(
source_details.url, {"branch": "other"})
source_transport = get_transport_from_url(source_details.url)
- self.assertEquals(
+ self.assertEqual(
{"branch": "other"},
source_transport.get_segment_parameters())
worker = self.makeImportWorker(source_details,
@@ -1207,7 +1207,7 @@
CodeImportWorkerExitCode.SUCCESS, worker.run())
branch = worker.getBazaarBranch()
lastrev = branch.repository.get_revision(branch.last_revision())
- self.assertEquals(lastrev.message, "Message for other")
+ self.assertEqual(lastrev.message, "Message for other")
class TestBzrSvnImport(WorkerTest, SubversionImportHelpers,
@@ -1311,7 +1311,7 @@
self.policy = CodeImportBranchOpenPolicy("bzr", "bzr")
def test_follows_references(self):
- self.assertEquals(True, self.policy.shouldFollowReferences())
+ self.assertEqual(True, self.policy.shouldFollowReferences())
def assertBadUrl(self, url):
self.assertRaises(BadUrl, self.policy.checkOneURL, url)
@@ -1378,7 +1378,7 @@
branch_url = self.bazaar_store._getMirrorURL(
worker.source_details.target_id)
branch = Branch.open(branch_url)
- self.assertEquals(self.revid, branch.last_revision())
+ self.assertEqual(self.revid, branch.last_revision())
def test_redirect_to_forbidden_url(self):
class NewUrlBlacklistPolicy(BranchOpenPolicy):
=== modified file 'lib/lp/codehosting/scanner/tests/test_buglinks.py'
--- lib/lp/codehosting/scanner/tests/test_buglinks.py 2016-02-04 05:43:46 +0000
+++ lib/lp/codehosting/scanner/tests/test_buglinks.py 2018-01-02 16:24:23 +0000
@@ -61,7 +61,7 @@
# Parsing a single line should give a dict with a single entry,
# mapping the bug_id to the status.
bugs = self.extractBugInfo("https://launchpad.net/bugs/9999 fixed")
- self.assertEquals(bugs, {9999: 'fixed'})
+ self.assertEqual(bugs, {9999: 'fixed'})
def test_multiple(self):
# Information about more than one bug can be specified. Make sure that
@@ -69,39 +69,39 @@
bugs = self.extractBugInfo(
"https://launchpad.net/bugs/9999 fixed\n"
"https://launchpad.net/bugs/8888 fixed")
- self.assertEquals(bugs, {9999: 'fixed',
- 8888: 'fixed'})
+ self.assertEqual(bugs, {9999: 'fixed',
+ 8888: 'fixed'})
def test_empty(self):
# If the property is empty, then return an empty dict.
bugs = self.extractBugInfo('')
- self.assertEquals(bugs, {})
+ self.assertEqual(bugs, {})
def test_bad_bug(self):
# If the given bug is not a valid integer, then skip it, generate an
# OOPS and continue processing.
bugs = self.extractBugInfo('https://launchpad.net/~jml fixed')
- self.assertEquals(bugs, {})
+ self.assertEqual(bugs, {})
def test_non_launchpad_bug(self):
# References to bugs on sites other than launchpad are ignored.
bugs = self.extractBugInfo('http://bugs.debian.org/1234 fixed')
- self.assertEquals(bugs, {})
+ self.assertEqual(bugs, {})
def test_duplicated_line(self):
# If a particular line is duplicated, silently ignore the duplicates.
bugs = self.extractBugInfo(
'https://launchpad.net/bugs/9999 fixed\n'
'https://launchpad.net/bugs/9999 fixed')
- self.assertEquals(bugs, {9999: 'fixed'})
+ self.assertEqual(bugs, {9999: 'fixed'})
def test_strict_url_checking(self):
# Ignore URLs that look like a Launchpad bug URL but aren't.
bugs = self.extractBugInfo('https://launchpad.net/people/1234 fixed')
- self.assertEquals(bugs, {})
+ self.assertEqual(bugs, {})
bugs = self.extractBugInfo(
'https://launchpad.net/bugs/foo/1234 fixed')
- self.assertEquals(bugs, {})
+ self.assertEqual(bugs, {})
class TestBugLinking(BzrSyncTestCase):
=== modified file 'lib/lp/codehosting/scanner/tests/test_bzrsync.py'
--- lib/lp/codehosting/scanner/tests/test_bzrsync.py 2018-01-02 10:54:31 +0000
+++ lib/lp/codehosting/scanner/tests/test_bzrsync.py 2018-01-02 16:24:23 +0000
@@ -359,7 +359,7 @@
self.commitRevision(committer=author)
self.syncAndCount(new_revisions=1, new_numbers=1, new_authors=1)
db_author = RevisionAuthor.selectOneBy(name=author)
- self.assertEquals(db_author.name, author)
+ self.assertEqual(db_author.name, author)
def test_new_parent(self):
# Importing two revisions should import a new parent.
@@ -371,13 +371,13 @@
def test_sync_updates_branch(self):
# test that the last scanned revision ID is recorded
self.syncAndCount()
- self.assertEquals(NULL_REVISION, self.db_branch.last_scanned_id)
+ self.assertEqual(NULL_REVISION, self.db_branch.last_scanned_id)
last_modified = self.db_branch.date_last_modified
last_scanned = self.db_branch.last_scanned
self.commitRevision()
self.syncAndCount(new_revisions=1, new_numbers=1, new_authors=1)
- self.assertEquals(self.bzr_branch.last_revision(),
- self.db_branch.last_scanned_id)
+ self.assertEqual(self.bzr_branch.last_revision(),
+ self.db_branch.last_scanned_id)
self.assertTrue(self.db_branch.last_scanned > last_scanned,
"last_scanned was not updated")
self.assertTrue(self.db_branch.date_last_modified > last_modified,
@@ -814,7 +814,7 @@
self.makeBzrSync(self.db_branch).syncBranchAndClose()
# Check that properties were saved to the revision.
bzr_revision = self.bzr_branch.repository.get_revision('rev1')
- self.assertEquals(properties, bzr_revision.properties)
+ self.assertEqual(properties, bzr_revision.properties)
# Check that properties are stored in the database.
db_revision = getUtility(IRevisionSet).getByRevisionId('rev1')
- self.assertEquals(properties, db_revision.getProperties())
+ self.assertEqual(properties, db_revision.getProperties())
=== modified file 'lib/lp/codehosting/sshserver/tests/test_session.py'
--- lib/lp/codehosting/sshserver/tests/test_session.py 2018-01-02 10:54:31 +0000
+++ lib/lp/codehosting/sshserver/tests/test_session.py 2018-01-02 16:24:23 +0000
@@ -435,7 +435,7 @@
self.assertRaises(ForbiddenCommand, lookup_command_template, 'foo')
def test_bzr(self):
- self.assertEquals(
+ self.assertEqual(
config.root + '/bin/py ' + get_bzr_path() +
' lp-serve --inet %(user_id)s',
lookup_command_template(
=== modified file 'lib/lp/codehosting/tests/test_safe_open.py'
--- lib/lp/codehosting/tests/test_safe_open.py 2012-09-06 00:01:38 +0000
+++ lib/lp/codehosting/tests/test_safe_open.py 2018-01-02 16:24:23 +0000
@@ -79,9 +79,8 @@
# When branch references are forbidden, checkAndFollowBranchReference
# does not raise on non-references.
opener = self.makeBranchOpener(False, ['a', None])
- self.assertEquals(
- 'a', opener.checkAndFollowBranchReference('a'))
- self.assertEquals(['a'], opener.follow_reference_calls)
+ self.assertEqual('a', opener.checkAndFollowBranchReference('a'))
+ self.assertEqual(['a'], opener.follow_reference_calls)
def testBranchReferenceForbidden(self):
# checkAndFollowBranchReference raises BranchReferenceForbidden if
@@ -91,16 +90,15 @@
self.assertRaises(
BranchReferenceForbidden,
opener.checkAndFollowBranchReference, 'a')
- self.assertEquals(['a'], opener.follow_reference_calls)
+ self.assertEqual(['a'], opener.follow_reference_calls)
def testAllowedReference(self):
# checkAndFollowBranchReference does not raise if following references
# is allowed and the source URL points to a branch reference to a
# permitted location.
opener = self.makeBranchOpener(True, ['a', 'b', None])
- self.assertEquals(
- 'b', opener.checkAndFollowBranchReference('a'))
- self.assertEquals(['a', 'b'], opener.follow_reference_calls)
+ self.assertEqual('b', opener.checkAndFollowBranchReference('a'))
+ self.assertEqual(['a', 'b'], opener.follow_reference_calls)
def testCheckReferencedURLs(self):
# checkAndFollowBranchReference checks if the URL a reference points
@@ -109,7 +107,7 @@
True, ['a', 'b', None], unsafe_urls=set('b'))
self.assertRaises(
BadUrl, opener.checkAndFollowBranchReference, 'a')
- self.assertEquals(['a'], opener.follow_reference_calls)
+ self.assertEqual(['a'], opener.follow_reference_calls)
def testSelfReferencingBranch(self):
# checkAndFollowBranchReference raises BranchReferenceLoopError if
@@ -118,7 +116,7 @@
opener = self.makeBranchOpener(True, ['a', 'a'])
self.assertRaises(
BranchLoopError, opener.checkAndFollowBranchReference, 'a')
- self.assertEquals(['a'], opener.follow_reference_calls)
+ self.assertEqual(['a'], opener.follow_reference_calls)
def testBranchReferenceLoop(self):
# checkAndFollowBranchReference raises BranchReferenceLoopError if
@@ -128,7 +126,7 @@
opener = self.makeBranchOpener(True, references)
self.assertRaises(
BranchLoopError, opener.checkAndFollowBranchReference, 'a')
- self.assertEquals(['a', 'b'], opener.follow_reference_calls)
+ self.assertEqual(['a', 'b'], opener.follow_reference_calls)
class TrackingProber(BzrProber):
@@ -166,7 +164,7 @@
opener = self.makeBranchOpener([b.base], probers=[])
self.assertRaises(NotBranchError, opener.open, b.base)
opener = self.makeBranchOpener([b.base], probers=[BzrProber])
- self.assertEquals(b.base, opener.open(b.base).base)
+ self.assertEqual(b.base, opener.open(b.base).base)
def testDefaultProbers(self):
# If no probers are specified to the constructor
@@ -180,18 +178,18 @@
TrackingProber.seen_urls = []
opener = self.makeBranchOpener(["."], probers=[TrackingProber])
self.assertRaises(NotBranchError, opener.open, ".")
- self.assertEquals(1, len(TrackingProber.seen_urls))
+ self.assertEqual(1, len(TrackingProber.seen_urls))
TrackingProber.seen_urls = []
# And make sure it's registered in such a way that BzrDir.open would
# use it.
self.assertRaises(NotBranchError, BzrDir.open, ".")
- self.assertEquals(1, len(TrackingProber.seen_urls))
+ self.assertEqual(1, len(TrackingProber.seen_urls))
TrackingProber.seen_urls = []
# Make sure that SafeBranchOpener doesn't use it if no
# probers were specified
opener = self.makeBranchOpener(["."])
self.assertRaises(NotBranchError, opener.open, ".")
- self.assertEquals(0, len(TrackingProber.seen_urls))
+ self.assertEqual(0, len(TrackingProber.seen_urls))
def testAllowedURL(self):
# checkSource does not raise an exception for branches stacked on
@@ -289,8 +287,7 @@
opener = self.makeBranchOpener(
[a.base, b.base], probers=[TrackingProber])
opener.open(b.base)
- self.assertEquals(
- set(TrackingProber.seen_urls), set([b.base, a.base]))
+ self.assertEqual(set(TrackingProber.seen_urls), set([b.base, a.base]))
def testCustomOpenerWithBranchReference(self):
# A custom function for opening a control dir can be specified.
@@ -301,8 +298,7 @@
opener = self.makeBranchOpener(
[a.base, b.base], probers=[TrackingProber])
opener.open(b.base)
- self.assertEquals(
- set(TrackingProber.seen_urls), set([b.base, a.base]))
+ self.assertEqual(set(TrackingProber.seen_urls), set([b.base, a.base]))
def test_ignore_fallbacks(self):
""""Cross-format stacking doesn't error with ignore_fallbacks."""
=== modified file 'lib/lp/registry/browser/tests/test_distroseries.py'
--- lib/lp/registry/browser/tests/test_distroseries.py 2017-10-21 18:14:14 +0000
+++ lib/lp/registry/browser/tests/test_distroseries.py 2018-01-02 16:24:23 +0000
@@ -592,7 +592,7 @@
[launchpad]
default_batch_size: 2
""")
- self.assert_(
+ self.assertTrue(
isinstance(view.milestone_batch_navigator, BatchNavigator),
'milestone_batch_navigator is not a BatchNavigator object: %r'
% view.milestone_batch_navigator)
@@ -693,7 +693,7 @@
distroseries = self.factory.makeDistroSeries()
formatted_dict = seriesToVocab(distroseries)
- self.assertEquals(
+ self.assertEqual(
['api_uri', 'title', 'value'],
sorted(formatted_dict.keys()))
@@ -1477,9 +1477,9 @@
job_source = getUtility(IPlainPackageCopyJobSource)
jobs = list(
job_source.getActiveJobs(series.distribution.main_archive))
- self.assertEquals(1, len(jobs))
+ self.assertEqual(1, len(jobs))
job = jobs[0]
- self.assertEquals(series, job.target_distroseries)
+ self.assertEqual(series, job.target_distroseries)
self.assertEqual(dsd.source_package_name.name, job.package_name)
self.assertEqual(dsd.parent_source_version, job.package_version)
self.assertEqual(PackagePublishingPocket.RELEASE, job.target_pocket)
@@ -2161,7 +2161,7 @@
derived_series, '+localpackagediffs', method='GET',
query_string='start=1&batch=1')
- self.assertEquals(
+ self.assertEqual(
'http://127.0.0.1?start=1&batch=1',
view.action_url)
=== modified file 'lib/lp/registry/browser/tests/test_person.py'
--- lib/lp/registry/browser/tests/test_person.py 2018-01-02 10:54:31 +0000
+++ lib/lp/registry/browser/tests/test_person.py 2018-01-02 16:24:23 +0000
@@ -189,7 +189,7 @@
def test_should_be_profile_page_when_delegating(self):
"""The profile page is the OpenID identifier in normal situation."""
- self.assertEquals(
+ self.assertEqual(
'http://launchpad.dev/~eris', self.view.openid_identity_url)
def test_should_be_production_profile_page_when_not_delegating(self):
@@ -202,7 +202,7 @@
[launchpad]
non_restricted_hostname: prod.launchpad.dev
'''))
- self.assertEquals(
+ self.assertEqual(
'http://prod.launchpad.dev/~eris', self.view.openid_identity_url)
=== modified file 'lib/lp/registry/browser/tests/test_person_webservice.py'
--- lib/lp/registry/browser/tests/test_person_webservice.py 2017-06-01 12:58:53 +0000
+++ lib/lp/registry/browser/tests/test_person_webservice.py 2018-01-02 16:24:23 +0000
@@ -151,7 +151,7 @@
self.assertEqual(response.status, 200)
rendered_comment = response.body
- self.assertEquals(
+ self.assertEqual(
rendered_comment,
'<a href="/~test-person" class="sprite person">Test Person</a>')
=== modified file 'lib/lp/registry/tests/test_distribution.py'
--- lib/lp/registry/tests/test_distribution.py 2018-01-02 10:54:31 +0000
+++ lib/lp/registry/tests/test_distribution.py 2018-01-02 16:24:23 +0000
@@ -151,7 +151,7 @@
distroseries = self.factory.makeDistroSeries()
spph = self.factory.makeSourcePackagePublishingHistory(
distroseries=distroseries, sourcepackagename='my-package')
- self.assertEquals(
+ self.assertEqual(
spph.sourcepackagerelease.sourcepackagename,
distroseries.distribution.guessPublishedSourcePackageName(
'my-package'))
@@ -164,7 +164,7 @@
archive=distroseries.main_archive,
binarypackagename='binary-package',
source_package_release=spph.sourcepackagerelease)
- self.assertEquals(
+ self.assertEqual(
spph.sourcepackagerelease.sourcepackagename,
distroseries.distribution.guessPublishedSourcePackageName(
'binary-package'))
@@ -188,7 +188,7 @@
distroseries2 = self.factory.makeDistroSeries()
spph = self.factory.makeSourcePackagePublishingHistory(
distroseries=distroseries1, sourcepackagename='my-package')
- self.assertEquals(
+ self.assertEqual(
spph.sourcepackagerelease.sourcepackagename,
distroseries1.distribution.guessPublishedSourcePackageName(
'my-package'))
@@ -206,7 +206,7 @@
self.factory.makeBinaryPackagePublishingHistory(
archive=distroseries.main_archive,
binarypackagename='my-package', sourcepackagename='other-package')
- self.assertEquals(
+ self.assertEqual(
my_spph.sourcepackagerelease.sourcepackagename,
distroseries.distribution.guessPublishedSourcePackageName(
'my-package'))
@@ -223,7 +223,7 @@
archive=distroseries.main_archive,
sourcepackagename='new-source-name',
binarypackagename='my-package')
- self.assertEquals(
+ self.assertEqual(
'new-source-name',
distroseries.distribution.guessPublishedSourcePackageName(
'my-package').name)
@@ -235,7 +235,7 @@
sourcepackagename='my-package')
self.factory.makeRelatedBranchesForSourcePackage(
sourcepackage=sourcepackage)
- self.assertEquals(
+ self.assertEqual(
'my-package',
sourcepackage.distribution.guessPublishedSourcePackageName(
'my-package').name)
@@ -371,14 +371,14 @@
def test_get_none(self):
distro = self.factory.makeDistribution()
- self.assertEquals([],
+ self.assertEqual([],
list(distro.getSeriesByStatus(SeriesStatus.FROZEN)))
def test_get_current(self):
distro = self.factory.makeDistribution()
series = self.factory.makeDistroSeries(distribution=distro,
status=SeriesStatus.CURRENT)
- self.assertEquals([series],
+ self.assertEqual([series],
list(distro.getSeriesByStatus(SeriesStatus.CURRENT)))
@@ -396,13 +396,13 @@
distro = self.factory.makeDistribution()
series = self.factory.makeDistroSeries(distribution=distro,
name="dappere")
- self.assertEquals(series, distro.getSeries("dappere"))
+ self.assertEqual(series, distro.getSeries("dappere"))
def test_get_by_version(self):
distro = self.factory.makeDistribution()
series = self.factory.makeDistroSeries(distribution=distro,
name="dappere", version="42.6")
- self.assertEquals(series, distro.getSeries("42.6"))
+ self.assertEqual(series, distro.getSeries("42.6"))
def test_development_series_alias(self):
distro = self.factory.makeDistribution()
=== modified file 'lib/lp/registry/tests/test_distributionmirror_prober.py'
--- lib/lp/registry/tests/test_distributionmirror_prober.py 2018-01-02 10:54:31 +0000
+++ lib/lp/registry/tests/test_distributionmirror_prober.py 2018-01-02 16:24:23 +0000
@@ -261,7 +261,7 @@
protocol.factory = FakeFactory('http://foo.bar/')
protocol.makeConnection(FakeTransport())
- self.assertEquals(
+ self.assertEqual(
'Launchpad Mirror Prober ( https://launchpad.net/ )',
headers['User-Agent'])
@@ -475,10 +475,10 @@
there's no task currently running.
"""
self.multi_lock.run(self.callback)
- self.assertEquals(self.count, 1, "self.callback should have run.")
+ self.assertEqual(self.count, 1, "self.callback should have run.")
self.multi_lock.run(self.callback)
- self.assertEquals(
+ self.assertEqual(
self.count, 2, "self.callback should have run twice.")
def test_run_waits_for_first_lock(self):
@@ -489,7 +489,7 @@
# Run self.callback when self.multi_lock is acquired.
self.multi_lock.run(self.callback)
- self.assertEquals(
+ self.assertEqual(
self.count, 0, "self.callback should not have run yet.")
# Release lock_one.
@@ -497,7 +497,7 @@
# multi_lock will now have been able to acquire both semaphores, and
# so it will have run its task.
- self.assertEquals(self.count, 1, "self.callback should have run.")
+ self.assertEqual(self.count, 1, "self.callback should have run.")
def test_run_waits_for_second_lock(self):
"""MultiLock.run acquires the second lock before running functions."""
@@ -507,7 +507,7 @@
# Run self.callback when self.multi_lock is acquired.
self.multi_lock.run(self.callback)
- self.assertEquals(
+ self.assertEqual(
self.count, 0, "self.callback should not have run yet.")
# Release lock_two.
@@ -515,7 +515,7 @@
# multi_lock will now have been able to acquire both semaphores, and
# so it will have run its task.
- self.assertEquals(self.count, 1, "self.callback should have run.")
+ self.assertEqual(self.count, 1, "self.callback should have run.")
def test_run_waits_for_current_task(self):
"""MultiLock.run waits the end of the current task before running the
@@ -527,7 +527,7 @@
# Run self.callback when self.multi_lock is acquired.
self.multi_lock.run(self.callback)
- self.assertEquals(
+ self.assertEqual(
self.count, 0, "self.callback should not have run yet.")
# Release lock_one.
@@ -535,7 +535,7 @@
# multi_lock will now have been able to acquire both semaphores, and
# so it will have run its task.
- self.assertEquals(self.count, 1, "self.callback should have run.")
+ self.assertEqual(self.count, 1, "self.callback should have run.")
class TestRedirectAwareProberFactoryAndProtocol(TestCase):
@@ -879,28 +879,28 @@
# Since we have a single mirror to probe we need to have a single
# DeferredSemaphore with a limit of PER_HOST_REQUESTS, to ensure we
# don't issue too many simultaneous connections on that host.
- self.assertEquals(len(request_manager.host_locks), 1)
+ self.assertEqual(len(request_manager.host_locks), 1)
multi_lock = request_manager.host_locks[mirror1_host]
- self.assertEquals(multi_lock.host_lock.limit, PER_HOST_REQUESTS)
+ self.assertEqual(multi_lock.host_lock.limit, PER_HOST_REQUESTS)
# Note that our multi_lock contains another semaphore to control the
# overall number of requests.
- self.assertEquals(multi_lock.overall_lock.limit, OVERALL_REQUESTS)
+ self.assertEqual(multi_lock.overall_lock.limit, OVERALL_REQUESTS)
probe_function(mirror2, StringIO(), [], logging)
# Now we have two mirrors to probe, but they have the same hostname,
# so we'll still have a single semaphore in host_semaphores.
- self.assertEquals(mirror2_host, mirror1_host)
- self.assertEquals(len(request_manager.host_locks), 1)
+ self.assertEqual(mirror2_host, mirror1_host)
+ self.assertEqual(len(request_manager.host_locks), 1)
multi_lock = request_manager.host_locks[mirror2_host]
- self.assertEquals(multi_lock.host_lock.limit, PER_HOST_REQUESTS)
+ self.assertEqual(multi_lock.host_lock.limit, PER_HOST_REQUESTS)
probe_function(mirror3, StringIO(), [], logging)
# This third mirror is on a separate host, so we'll have a second
# semaphore added to host_semaphores.
- self.failUnless(mirror3_host != mirror1_host)
- self.assertEquals(len(request_manager.host_locks), 2)
+ self.assertTrue(mirror3_host != mirror1_host)
+ self.assertEqual(len(request_manager.host_locks), 2)
multi_lock = request_manager.host_locks[mirror3_host]
- self.assertEquals(multi_lock.host_lock.limit, PER_HOST_REQUESTS)
+ self.assertEqual(multi_lock.host_lock.limit, PER_HOST_REQUESTS)
# When using an http_proxy, even though we'll actually connect to the
# proxy, we'll use the mirror's host as the key to find the semaphore
@@ -908,7 +908,7 @@
orig_proxy = os.getenv('http_proxy')
os.environ['http_proxy'] = 'http://squid.internal:3128/'
probe_function(mirror3, StringIO(), [], logging)
- self.assertEquals(len(request_manager.host_locks), 2)
+ self.assertEqual(len(request_manager.host_locks), 2)
restore_http_proxy(orig_proxy)
=== modified file 'lib/lp/registry/tests/test_distroseries.py'
--- lib/lp/registry/tests/test_distroseries.py 2018-01-02 10:54:31 +0000
+++ lib/lp/registry/tests/test_distroseries.py 2018-01-02 16:24:23 +0000
@@ -222,7 +222,7 @@
distroarchseries = self.factory.makeDistroArchSeries(
distroseries=distroseries, architecturetag='i386',
processor=processor)
- self.assertEquals(
+ self.assertEqual(
distroarchseries,
distroseries.getDistroArchSeriesByProcessor(processor))
@@ -236,7 +236,7 @@
def test_getDerivedSeries(self):
dsp = self.factory.makeDistroSeriesParent()
- self.assertEquals(
+ self.assertEqual(
[dsp.derived_series], dsp.parent_series.getDerivedSeries())
def test_registrant_owner_differ(self):
@@ -244,8 +244,8 @@
# distribution's owner.
registrant = self.factory.makePerson()
distroseries = self.factory.makeDistroSeries(registrant=registrant)
- self.assertEquals(distroseries.distribution.owner, distroseries.owner)
- self.assertEquals(registrant, distroseries.registrant)
+ self.assertEqual(distroseries.distribution.owner, distroseries.owner)
+ self.assertEqual(registrant, distroseries.registrant)
self.assertNotEqual(distroseries.registrant, distroseries.owner)
def test_isDerivedSeries(self):
=== modified file 'lib/lp/registry/tests/test_distroseriesdifference.py'
--- lib/lp/registry/tests/test_distroseriesdifference.py 2014-11-09 11:48:34 +0000
+++ lib/lp/registry/tests/test_distroseriesdifference.py 2018-01-02 16:24:23 +0000
@@ -436,7 +436,7 @@
packagesets = self._setupPackageSets(
ds_diff, ds_diff.parent_series, 5)
parent_packagesets = ds_diff.parent_packagesets
- self.assertEquals(
+ self.assertEqual(
sorted([packageset.name for packageset in packagesets]),
[packageset.name for packageset in parent_packagesets])
@@ -445,7 +445,7 @@
ds_diff = self.factory.makeDistroSeriesDifference()
packagesets = self._setupPackageSets(
ds_diff, ds_diff.derived_series, 5)
- self.assertEquals(
+ self.assertEqual(
sorted([packageset.name for packageset in packagesets]),
[packageset.name for packageset in ds_diff.packagesets])
=== modified file 'lib/lp/registry/tests/test_distroseriesparent.py'
--- lib/lp/registry/tests/test_distroseriesparent.py 2014-07-30 23:48:56 +0000
+++ lib/lp/registry/tests/test_distroseriesparent.py 2018-01-02 16:24:23 +0000
@@ -135,7 +135,7 @@
def assertCanEdit(self, dsp):
dsp.initialized = False
- self.assertEquals(False, dsp.initialized)
+ self.assertEqual(False, dsp.initialized)
def test_distroseries_drivers_can_edit(self):
# Test that distroseries drivers can edit the data.
=== modified file 'lib/lp/registry/tests/test_initderiveddistroseries.py'
--- lib/lp/registry/tests/test_initderiveddistroseries.py 2013-02-14 01:10:48 +0000
+++ lib/lp/registry/tests/test_initderiveddistroseries.py 2018-01-02 16:24:23 +0000
@@ -90,7 +90,7 @@
p.getBuiltBinaries()[0].binarypackagerelease.version)
for p in pub_sources])
- self.assertEquals(pack_versions, binaries)
+ self.assertEqual(pack_versions, binaries)
def test_multiple_parents_binary_packages(self):
# An initialization from many parents (using the package copier)
=== modified file 'lib/lp/registry/tests/test_milestonetag.py'
--- lib/lp/registry/tests/test_milestonetag.py 2015-01-29 14:14:01 +0000
+++ lib/lp/registry/tests/test_milestonetag.py 2018-01-02 16:24:23 +0000
@@ -38,7 +38,7 @@
def test_no_tags(self):
# Ensure a newly created milestone does not have associated tags.
- self.assertEquals([], self.milestone.getTags())
+ self.assertEqual([], self.milestone.getTags())
def test_tags_setting_and_retrieval(self):
# Ensure tags are correctly saved and retrieved from the db.
@@ -59,7 +59,7 @@
with person_logged_in(self.person):
self.milestone.setTags(self.tags, self.person)
self.milestone.setTags([], self.person)
- self.assertEquals([], self.milestone.getTags())
+ self.assertEqual([], self.milestone.getTags())
def test_user_metadata(self):
# Ensure the correct user metadata is created when tags are added.
=== modified file 'lib/lp/registry/tests/test_person.py'
--- lib/lp/registry/tests/test_person.py 2018-01-02 10:54:31 +0000
+++ lib/lp/registry/tests/test_person.py 2018-01-02 16:24:23 +0000
@@ -807,7 +807,7 @@
login(user.preferredemail.email)
expected_error = ('This account cannot be deactivated because it owns '
'the following non-public products: private')
- self.assertEquals([expected_error], user.canDeactivate())
+ self.assertEqual([expected_error], user.canDeactivate())
def test_deactivate_copes_with_names_already_in_use(self):
"""When a user deactivates their account, their name is changed.
=== modified file 'lib/lp/registry/tests/test_person_vocabularies.py'
--- lib/lp/registry/tests/test_person_vocabularies.py 2012-08-13 21:33:47 +0000
+++ lib/lp/registry/tests/test_person_vocabularies.py 2018-01-02 16:24:23 +0000
@@ -108,7 +108,7 @@
"""
if expected is not None:
expected = expected % context.id
- self.assertEquals(
+ self.assertEqual(
expected,
removeSecurityProxy(
self.getVocabulary(context))._karma_context_constraint)
@@ -233,7 +233,7 @@
results = list(self.searchVocabulary(None, u'foobar'))
with StormStatementRecorder() as recorder:
- self.assertEquals(4, len(results))
+ self.assertEqual(4, len(results))
for person in results:
self.assertEqual(
expected_nicks[person.id], person.ircnicknames)
=== modified file 'lib/lp/registry/tests/test_personroles.py'
--- lib/lp/registry/tests/test_personroles.py 2014-06-12 01:04:30 +0000
+++ lib/lp/registry/tests/test_personroles.py 2018-01-02 16:24:23 +0000
@@ -79,7 +79,7 @@
def test_inTeam(self):
# The method person.inTeam is available as the inTeam attribute.
roles = IPersonRoles(self.person)
- self.assertEquals(self.person.inTeam, roles.inTeam)
+ self.assertEqual(self.person.inTeam, roles.inTeam)
def test_inTeam_works(self):
# Make sure it actually works.
=== modified file 'lib/lp/registry/tests/test_personset.py'
--- lib/lp/registry/tests/test_personset.py 2018-01-02 10:54:31 +0000
+++ lib/lp/registry/tests/test_personset.py 2018-01-02 16:24:23 +0000
@@ -569,7 +569,7 @@
ensured_person = self.person_set.ensurePerson(
self.email_address, self.displayname, self.rationale)
- self.assertEquals(testing_person.id, ensured_person.id)
+ self.assertEqual(testing_person.id, ensured_person.id)
self.assertIsNot(
ensured_person.displayname, self.displayname,
'Person.displayname should not be overridden.')
@@ -655,10 +655,10 @@
u'other-openid-identifier', 'a@xxxxx')
self.assertEqual(other_person, person)
- self.assert_(
- u'other-openid-identifier' in [
- identifier.identifier for identifier in removeSecurityProxy(
- person.account).openid_identifiers])
+ self.assertIn(
+ u'other-openid-identifier',
+ [identifier.identifier for identifier in removeSecurityProxy(
+ person.account).openid_identifiers])
class TestPersonSetGetOrCreateSoftwareCenterCustomer(TestCaseWithFactory):
=== modified file 'lib/lp/registry/tests/test_pillar.py'
--- lib/lp/registry/tests/test_pillar.py 2016-04-14 05:16:26 +0000
+++ lib/lp/registry/tests/test_pillar.py 2018-01-02 16:24:23 +0000
@@ -40,7 +40,7 @@
pillar.name for pillar in
pillar_set.search(
getUtility(IPersonSet).getByName('mark'), 'lz', limit=5)]
- self.assertEquals(result_names, [u'launchzap', u'lz-bar', u'lz-foo'])
+ self.assertEqual(result_names, [u'launchzap', u'lz-bar', u'lz-foo'])
class TestPillarPerson(TestCaseWithFactory):
=== modified file 'lib/lp/registry/tests/test_prf_filter.py'
--- lib/lp/registry/tests/test_prf_filter.py 2018-01-02 10:54:31 +0000
+++ lib/lp/registry/tests/test_prf_filter.py 2018-01-02 16:24:23 +0000
@@ -22,7 +22,7 @@
from logging import getLogger
parent = getLogger("foo")
f = Filter(log_parent=parent)
- self.assertEquals(f.log.parent, parent)
+ self.assertEqual(f.log.parent, parent)
class Filter_Init(unittest.TestCase):
@@ -31,15 +31,15 @@
from lp.registry.scripts.productreleasefinder.filter import (
Filter)
f = Filter()
- self.assertEquals(f.filters, [])
+ self.assertEqual(f.filters, [])
def testFiltersPropertyGiven(self):
"""Filter constructor accepts argument to set filters property."""
from lp.registry.scripts.productreleasefinder.filter import (
Filter)
f = Filter(["wibble"])
- self.assertEquals(len(f.filters), 1)
- self.assertEquals(f.filters[0], "wibble")
+ self.assertEqual(len(f.filters), 1)
+ self.assertEqual(f.filters[0], "wibble")
class Filter_CheckUrl(unittest.TestCase):
@@ -48,7 +48,7 @@
from lp.registry.scripts.productreleasefinder.filter import (
Filter)
f = Filter()
- self.assertEquals(f.check("file:///subdir/file"), None)
+ self.assertEqual(f.check("file:///subdir/file"), None)
def makeFilter(self, key, urlglob):
from lp.registry.scripts.productreleasefinder.filter import (
@@ -59,27 +59,27 @@
def testNotMatching(self):
"""Filter.check returns None if doesn't match a filter."""
f = self.makeFilter("foo", "file:///subdir/w*")
- self.assertEquals(f.check("file:///subdir/file"), None)
+ self.assertEqual(f.check("file:///subdir/file"), None)
def testNoMatchingSlashes(self):
"""Filter.check that the glob does not match slashes."""
f = self.makeFilter("foo", "file:///*l*")
- self.assertEquals(f.check("file:///subdir/file"), None)
+ self.assertEqual(f.check("file:///subdir/file"), None)
def testReturnsMatching(self):
"""Filter.check returns the matching keyword."""
f = self.makeFilter("foo", "file:///subdir/f*e")
- self.assertEquals(f.check("file:///subdir/file"), "foo")
+ self.assertEqual(f.check("file:///subdir/file"), "foo")
def testGlobSubdir(self):
# Filter.glob can contain slashes to match subdirs
f = self.makeFilter("foo", "file:///sub*/f*e")
- self.assertEquals(f.check("file:///subdir/file"), "foo")
+ self.assertEqual(f.check("file:///subdir/file"), "foo")
def testReturnsNonMatchingBase(self):
"""Filter.check returns None if the base does not match."""
f = self.makeFilter("foo", "http:f*e")
- self.assertEquals(f.check("file:///subdir/file"), None)
+ self.assertEqual(f.check("file:///subdir/file"), None)
class Filter_IsPossibleParentUrl(unittest.TestCase):
=== modified file 'lib/lp/registry/tests/test_prf_hose.py'
--- lib/lp/registry/tests/test_prf_hose.py 2018-01-02 10:54:31 +0000
+++ lib/lp/registry/tests/test_prf_hose.py 2018-01-02 16:24:23 +0000
@@ -29,7 +29,7 @@
from logging import getLogger
parent = getLogger("foo")
h = Hose(log_parent=parent)
- self.assertEquals(h.log.parent, parent)
+ self.assertEqual(h.log.parent, parent)
class Hose_Filter(unittest.TestCase):
@@ -45,7 +45,7 @@
"""Hose creates Filter object with empty dictionary."""
from lp.registry.scripts.productreleasefinder.hose import Hose
h = Hose()
- self.assertEquals(h.filter.filters, [])
+ self.assertEqual(h.filter.filters, [])
def testCreatesFiltersWithGiven(self):
"""Hose creates Filter object with dictionary given."""
@@ -54,8 +54,8 @@
FilterPattern)
pattern = FilterPattern("foo", "http:e*")
h = Hose([pattern])
- self.assertEquals(len(h.filter.filters), 1)
- self.assertEquals(h.filter.filters[0], pattern)
+ self.assertEqual(len(h.filter.filters), 1)
+ self.assertEqual(h.filter.filters[0], pattern)
class Hose_Urls(unittest.TestCase):
@@ -74,7 +74,7 @@
obs = Observer()
instrument_method(obs, h, "reduceWork")
h.__init__()
- self.assert_(obs.called_it)
+ self.assertTrue(obs.called_it)
def testPassesUrlList(self):
"""Hose constructor passes url list to reduceWork."""
@@ -94,8 +94,7 @@
obs = Observer()
instrument_method(obs, h, "reduceWork")
h.__init__([pattern])
- self.assertEquals(obs.args[0][0],
- ["http://archive.ubuntu.com/"])
+ self.assertEqual(obs.args[0][0], ["http://archive.ubuntu.com/"])
def testSetsUrlProperty(self):
"""Hose constructor sets urls property to reduceWork return value."""
@@ -106,7 +105,7 @@
return "wibble"
h = TestHose()
- self.assertEquals(h.urls, "wibble")
+ self.assertEqual(h.urls, "wibble")
class Hose_ReduceWork(unittest.TestCase):
@@ -114,24 +113,24 @@
"""Hose.reduceWork returns empty list when given one."""
from lp.registry.scripts.productreleasefinder.hose import Hose
h = Hose()
- self.assertEquals(h.reduceWork([]), [])
+ self.assertEqual(h.reduceWork([]), [])
def testReducedList(self):
"""Hose.reduceWork returns same list when nothing to do."""
from lp.registry.scripts.productreleasefinder.hose import Hose
h = Hose()
- self.assertEquals(h.reduceWork(["http://localhost/", "file:///usr/"]),
- ["http://localhost/", "file:///usr/"])
+ self.assertEqual(h.reduceWork(["http://localhost/", "file:///usr/"]),
+ ["http://localhost/", "file:///usr/"])
def testReducesList(self):
"""Hose.reduceWork removes children elements from list."""
from lp.registry.scripts.productreleasefinder.hose import Hose
h = Hose()
- self.assertEquals(h.reduceWork(["http://localhost/",
- "http://localhost/foo/bar/",
- "http://localhost/wibble/",
- "file:///usr/"]),
- ["http://localhost/", "file:///usr/"])
+ self.assertEqual(h.reduceWork(["http://localhost/",
+ "http://localhost/foo/bar/",
+ "http://localhost/wibble/",
+ "file:///usr/"]),
+ ["http://localhost/", "file:///usr/"])
class Hose_LimitWalk(unittest.TestCase):
=== modified file 'lib/lp/registry/tests/test_prf_log.py'
--- lib/lp/registry/tests/test_prf_log.py 2018-01-02 10:54:31 +0000
+++ lib/lp/registry/tests/test_prf_log.py 2018-01-02 16:24:23 +0000
@@ -20,20 +20,20 @@
def testNoParent(self):
"""get_logger works if no parent is given."""
from lp.registry.scripts.productreleasefinder.log import get_logger
- self.assertEquals(get_logger("test").name, "test")
+ self.assertEqual(get_logger("test").name, "test")
def testRootParent(self):
"""get_logger works if root logger is given."""
from lp.registry.scripts.productreleasefinder.log import get_logger
from logging import root
- self.assertEquals(get_logger("test", root).name, "test")
+ self.assertEqual(get_logger("test", root).name, "test")
def testNormalParent(self):
"""get_logger works if non-root logger is given."""
from lp.registry.scripts.productreleasefinder.log import get_logger
from logging import getLogger
parent = getLogger("foo")
- self.assertEquals(get_logger("test", parent).name, "foo.test")
+ self.assertEqual(get_logger("test", parent).name, "foo.test")
def testDeepParent(self):
"""get_logger works if deep-level logger is given."""
@@ -41,4 +41,4 @@
from logging import getLogger
getLogger("foo")
parent2 = getLogger("foo.bar")
- self.assertEquals(get_logger("test", parent2).name, "foo.bar.test")
+ self.assertEqual(get_logger("test", parent2).name, "foo.bar.test")
=== modified file 'lib/lp/registry/tests/test_prf_walker.py'
--- lib/lp/registry/tests/test_prf_walker.py 2018-01-02 10:54:31 +0000
+++ lib/lp/registry/tests/test_prf_walker.py 2018-01-02 16:24:23 +0000
@@ -29,7 +29,7 @@
from logging import getLogger
parent = getLogger("foo")
w = WalkerBase("/", log_parent=parent)
- self.assertEquals(w.log.parent, parent)
+ self.assertEqual(w.log.parent, parent)
class WalkerBase_Base(TestCase):
@@ -37,22 +37,22 @@
def testSetsBase(self):
"""WalkerBase sets the base property."""
w = WalkerBase("ftp://localhost/")
- self.assertEquals(w.base, "ftp://localhost/")
+ self.assertEqual(w.base, "ftp://localhost/")
def testSetsScheme(self):
"""WalkerBase sets the scheme property."""
w = WalkerBase("ftp://localhost/")
- self.assertEquals(w.scheme, "ftp")
+ self.assertEqual(w.scheme, "ftp")
def testSetsHost(self):
"""WalkerBase sets the host property."""
w = WalkerBase("ftp://localhost/")
- self.assertEquals(w.host, "localhost")
+ self.assertEqual(w.host, "localhost")
def testNoScheme(self):
"""WalkerBase works when given a URL with no scheme."""
w = WalkerBase("/")
- self.assertEquals(w.host, "")
+ self.assertEqual(w.host, "")
def testWrongScheme(self):
"""WalkerBase raises WalkerError when given an unhandled scheme."""
@@ -63,75 +63,75 @@
def testUnescapesHost(self):
"""WalkerBase unescapes the host portion."""
w = WalkerBase("ftp://local%40host/")
- self.assertEquals(w.host, "local@host")
+ self.assertEqual(w.host, "local@host")
def testNoUsername(self):
"""WalkerBase stores None when there is no username."""
w = WalkerBase("ftp://localhost/")
- self.assertEquals(w.user, None)
+ self.assertEqual(w.user, None)
def testUsername(self):
"""WalkerBase splits out the username from the host portion."""
w = WalkerBase("ftp://scott@localhost/")
- self.assertEquals(w.user, "scott")
- self.assertEquals(w.host, "localhost")
+ self.assertEqual(w.user, "scott")
+ self.assertEqual(w.host, "localhost")
def testUnescapesUsername(self):
"""WalkerBase unescapes the username portion."""
w = WalkerBase("ftp://scott%3awibble@localhost/")
- self.assertEquals(w.user, "scott:wibble")
- self.assertEquals(w.host, "localhost")
+ self.assertEqual(w.user, "scott:wibble")
+ self.assertEqual(w.host, "localhost")
def testNoPassword(self):
"""WalkerBase stores None when there is no password."""
w = WalkerBase("ftp://scott@localhost/")
- self.assertEquals(w.passwd, None)
+ self.assertEqual(w.passwd, None)
def testPassword(self):
"""WalkerBase splits out the password from the username."""
w = WalkerBase("ftp://scott:wibble@localhost/")
- self.assertEquals(w.user, "scott")
- self.assertEquals(w.passwd, "wibble")
- self.assertEquals(w.host, "localhost")
+ self.assertEqual(w.user, "scott")
+ self.assertEqual(w.passwd, "wibble")
+ self.assertEqual(w.host, "localhost")
def testUnescapesPassword(self):
"""WalkerBase unescapes the password portion."""
w = WalkerBase("ftp://scott:wibble%20wobble@localhost/")
- self.assertEquals(w.user, "scott")
- self.assertEquals(w.passwd, "wibble wobble")
- self.assertEquals(w.host, "localhost")
+ self.assertEqual(w.user, "scott")
+ self.assertEqual(w.passwd, "wibble wobble")
+ self.assertEqual(w.host, "localhost")
def testPathOnly(self):
"""WalkerBase stores the path if that's all there is."""
w = WalkerBase("/path/to/something/")
- self.assertEquals(w.path, "/path/to/something/")
+ self.assertEqual(w.path, "/path/to/something/")
def testPathInUrl(self):
"""WalkerBase stores the path portion of a complete URL."""
w = WalkerBase("ftp://localhost/path/to/something/")
- self.assertEquals(w.path, "/path/to/something/")
+ self.assertEqual(w.path, "/path/to/something/")
def testAddsSlashToPath(self):
"""WalkerBase adds a trailing slash to path if ommitted."""
w = WalkerBase("ftp://localhost/path/to/something")
- self.assertEquals(w.path, "/path/to/something/")
+ self.assertEqual(w.path, "/path/to/something/")
def testUnescapesPath(self):
"""WalkerBase leaves the path escaped."""
w = WalkerBase("ftp://localhost/some%20thing/")
- self.assertEquals(w.path, "/some%20thing/")
+ self.assertEqual(w.path, "/some%20thing/")
def testStoresQuery(self):
"""WalkerBase stores the query portion of a supporting URL."""
w = WalkerBase("http://localhost/?foo")
- self.assertEquals(w.query, "foo")
+ self.assertEqual(w.query, "foo")
def testStoresFragment(self):
"""WalkerBase stores the fragment portion of a supporting URL."""
WalkerBase.FRAGMENTS = True
try:
w = WalkerBase("http://localhost/#foo")
- self.assertEquals(w.fragment, "foo")
+ self.assertEqual(w.fragment, "foo")
finally:
WalkerBase.FRAGMENTS = False
@@ -204,14 +204,14 @@
from lp.registry.scripts.productreleasefinder.walker import (
FTPWalker)
w = FTPWalker("ftp://localhost/")
- self.assertEquals(w.host, "localhost")
+ self.assertEqual(w.host, "localhost")
def testNoScheme(self):
"""FTPWalker works when given a URL with no scheme."""
from lp.registry.scripts.productreleasefinder.walker import (
FTPWalker)
w = FTPWalker("/")
- self.assertEquals(w.host, "")
+ self.assertEqual(w.host, "")
def testWrongScheme(self):
"""FTPWalker raises WalkerError when given an unhandled scheme."""
@@ -224,14 +224,14 @@
from lp.registry.scripts.productreleasefinder.walker import (
FTPWalker)
w = FTPWalker("ftp://localhost/")
- self.assertEquals(w.user, "anonymous")
+ self.assertEqual(w.user, "anonymous")
def testNoPassword(self):
"""FTPWalker stores empty string when there is no password."""
from lp.registry.scripts.productreleasefinder.walker import (
FTPWalker)
w = FTPWalker("ftp://scott@localhost/")
- self.assertEquals(w.passwd, "")
+ self.assertEqual(w.passwd, "")
class HTTPWalker_Base(TestCase):
@@ -241,21 +241,21 @@
from lp.registry.scripts.productreleasefinder.walker import (
HTTPWalker)
w = HTTPWalker("http://localhost/")
- self.assertEquals(w.host, "localhost")
+ self.assertEqual(w.host, "localhost")
def testHttpsScheme(self):
"""HTTPWalker works when initialized with an https-scheme URL."""
from lp.registry.scripts.productreleasefinder.walker import (
HTTPWalker)
w = HTTPWalker("https://localhost/")
- self.assertEquals(w.host, "localhost")
+ self.assertEqual(w.host, "localhost")
def testNoScheme(self):
"""HTTPWalker works when given a URL with no scheme."""
from lp.registry.scripts.productreleasefinder.walker import (
HTTPWalker)
w = HTTPWalker("/")
- self.assertEquals(w.host, "")
+ self.assertEqual(w.host, "")
def testWrongScheme(self):
"""HTTPWalker raises WalkerError when given an unhandled scheme."""
@@ -274,13 +274,13 @@
self.walker = HTTPWalker("http://localhost/")
def verify_url_scheme_and_handler(self, scheme, handler):
- self.assert_(scheme in self.walker.URL_SCHEMES)
- self.assert_(handler in self.walker.handlers)
+ self.assertIn(scheme, self.walker.URL_SCHEMES)
+ self.assertIn(handler, self.walker.handlers)
# urllib2 uses a naming convention to select the handler for
# a URL scheme. This test is sanity to check to ensure that the
# HTTPWalker's configuration of the OpenerDirector is will work.
method_name = '%s_open' % scheme
- self.assert_(safe_hasattr(handler, method_name))
+ self.assertTrue(safe_hasattr(handler, method_name))
def test_http_request(self):
import urllib2
@@ -503,7 +503,7 @@
"""combine_url constructs the URL correctly."""
from lp.registry.scripts.productreleasefinder.walker import (
combine_url)
- self.assertEquals(combine_url("file:///base", "/subdir/", "file"),
- "file:///subdir/file")
- self.assertEquals(combine_url("file:///base", "/subdir", "file"),
- "file:///subdir/file")
+ self.assertEqual(combine_url("file:///base", "/subdir/", "file"),
+ "file:///subdir/file")
+ self.assertEqual(combine_url("file:///base", "/subdir", "file"),
+ "file:///subdir/file")
=== modified file 'lib/lp/registry/tests/test_project_milestone.py'
--- lib/lp/registry/tests/test_project_milestone.py 2015-01-29 16:28:30 +0000
+++ lib/lp/registry/tests/test_project_milestone.py 2018-01-02 16:24:23 +0000
@@ -331,7 +331,7 @@
try:
milestone.createProductRelease(1, now)
except MultipleProductReleases as e:
- self.assert_(
+ self.assertTrue(
str(e), 'A milestone can only have one ProductRelease.')
def test_inappropriate_deactivation_does_not_cause_an_OOPS(self):
=== modified file 'lib/lp/registry/tests/test_teammembership.py'
--- lib/lp/registry/tests/test_teammembership.py 2018-01-02 10:54:31 +0000
+++ lib/lp/registry/tests/test_teammembership.py 2018-01-02 16:24:23 +0000
@@ -277,7 +277,7 @@
def assertParticipantsEquals(self, participant_names, team):
"""Assert that the participants names in team are the expected ones.
"""
- self.assertEquals(
+ self.assertEqual(
sorted(participant_names),
sorted([participant.name for participant in team.allmembers]))
=== modified file 'lib/lp/scripts/tests/test_runlaunchpad.py'
--- lib/lp/scripts/tests/test_runlaunchpad.py 2018-01-02 10:54:31 +0000
+++ lib/lp/scripts/tests/test_runlaunchpad.py 2018-01-02 16:24:23 +0000
@@ -113,11 +113,11 @@
instance_config_dir = os.path.join(self.config_root, 'test')
os.mkdir(instance_config_dir)
open(os.path.join(instance_config_dir, 'launchpad.conf'), 'w').close()
- self.assertEquals(
+ self.assertEqual(
['-o', 'foo', '-C', '%s/launchpad.conf' % instance_config_dir],
process_config_arguments(
['-i', 'test', '-o', 'foo']))
- self.assertEquals('test', config.instance_name)
+ self.assertEqual('test', config.instance_name)
class ServersToStart(testtools.TestCase):
=== modified file 'lib/lp/scripts/utilities/js/tests/test_combo.py'
--- lib/lp/scripts/utilities/js/tests/test_combo.py 2016-01-26 15:47:37 +0000
+++ lib/lp/scripts/utilities/js/tests/test_combo.py 2018-01-02 16:24:23 +0000
@@ -90,7 +90,7 @@
def test_parse_url_keeps_order(self):
"""Parsing a combo loader URL returns an ordered list of filenames."""
- self.assertEquals(
+ self.assertEqual(
parse_url(("http://yui.yahooapis.com/combo?"
"3.0.0/build/yui/yui-min.js&"
"3.0.0/build/oop/oop-min.js&"
@@ -124,7 +124,7 @@
"** oop-min **",
"// event-custom/event-custom-min.js",
"** event-custom-min **"))
- self.assertEquals(
+ self.assertEqual(
"".join(combine_files(["yui/yui-min.js",
"oop/oop-min.js",
"event-custom/event-custom-min.js"],
@@ -163,7 +163,7 @@
"/* editor/assets/skins/sam/editor.css */",
".yui-editor{background:url(editor/assets/skins/sam/img/bg.png)}",
))
- self.assertEquals(
+ self.assertEqual(
"".join(combine_files(["widget/assets/skins/sam/widget.css",
"editor/assets/skins/sam/editor.css"],
root=test_dir)).strip(),
@@ -225,7 +225,7 @@
"/* editor/assets/skins/sam/editor.css */",
".yui-editor{background:url(http://foo/static/img/bg.png)}",
))
- self.assertEquals(
+ self.assertEqual(
"".join(combine_files(["widget/assets/skins/sam/widget.css",
"editor/assets/skins/sam/editor.css"],
root=test_dir)).strip(),
@@ -263,7 +263,7 @@
'/* editor/assets/skins/sam/editor.css */',
'.yui-editor{background:url("data:image/gif;base64,base64-data")}',
))
- self.assertEquals(
+ self.assertEqual(
"".join(combine_files(["widget/assets/skins/sam/widget.css",
"editor/assets/skins/sam/editor.css"],
root=test_dir)).strip(),
@@ -306,7 +306,7 @@
" background: url(editor/assets/skins/sam/img/bg.png);",
"}",
))
- self.assertEquals(
+ self.assertEqual(
"".join(combine_files(["widget/assets/skins/sam/widget.css",
"editor/assets/skins/sam/editor.css"],
root=test_dir, minify_css=False)).strip(),
@@ -344,7 +344,7 @@
"/* editor/assets/skins/sam/editor.css */",
".yui-editor{background:url(img/bg.png)}",
))
- self.assertEquals(
+ self.assertEqual(
"".join(combine_files(["widget/assets/skins/sam/widget.css",
"editor/assets/skins/sam/editor.css"],
root=test_dir, rewrite_urls=False)).strip(),
@@ -388,7 +388,7 @@
' background: url("img/bg.png");',
'}',
))
- self.assertEquals(
+ self.assertEqual(
"".join(combine_files(["widget/assets/skins/sam/widget.css",
"editor/assets/skins/sam/editor.css"],
root=test_dir,
@@ -431,7 +431,7 @@
".yui-editor{background:url(" +
"/static/editor/assets/skins/sam/img/bg.png)}",
))
- self.assertEquals(
+ self.assertEqual(
"".join(combine_files(["widget/assets/skins/sam/widget.css",
"editor/assets/skins/sam/editor.css"],
root=test_dir,
@@ -459,7 +459,7 @@
"// [missing]",
"// event-custom/event-custom-min.js",
"** event-custom-min **"))
- self.assertEquals(
+ self.assertEqual(
"".join(combine_files(["yui/yui-min.js",
"oop/oop-min.js",
"event-custom/event-custom-min.js"],
@@ -482,7 +482,7 @@
expected = "\n".join(("// ../../oop/oop-min.js",
"// [missing]"))
- self.assertEquals(
+ self.assertEqual(
"".join(combine_files([hack], root=root)).strip(),
expected)
@@ -498,7 +498,7 @@
expected = "\n".join(("/* yui/base/base.css */",
".foo{background-image:url(img.png)}"))
- self.assertEquals(
+ self.assertEqual(
"".join(combine_files(files, root=test_dir)).strip(),
expected)
@@ -510,7 +510,7 @@
self.assertTrue(os.path.exists("/etc/passwd"))
expected = ""
- self.assertEquals(
+ self.assertEqual(
"".join(combine_files([hack], root=test_dir)).strip(),
expected)
@@ -548,8 +548,8 @@
["yui/yui-min.js",
"oop/oop-min.js",
"event-custom/event-custom-min.js"]), status=200)
- self.assertEquals(res.headers, [("Content-Type", "text/javascript")])
- self.assertEquals(res.body.strip(), expected)
+ self.assertEqual(res.headers, [("Content-Type", "text/javascript")])
+ self.assertEqual(res.body.strip(), expected)
def test_combo_app_sets_content_type_for_css(self):
"""The WSGI App should set a proper Content-Type for CSS."""
@@ -562,11 +562,11 @@
res = self.app.get("/?" + "&".join(
["widget/skin/sam/widget.css"]), status=200)
- self.assertEquals(res.headers, [("Content-Type", "text/css")])
- self.assertEquals(res.body.strip(), expected)
+ self.assertEqual(res.headers, [("Content-Type", "text/css")])
+ self.assertEqual(res.body.strip(), expected)
def test_no_filename_gives_404(self):
"""If no filename is included, a 404 should be returned."""
res = self.app.get("/", status=404)
- self.assertEquals(res.headers, [("Content-Type", "text/plain")])
- self.assertEquals(res.body, "Not Found")
+ self.assertEqual(res.headers, [("Content-Type", "text/plain")])
+ self.assertEqual(res.body, "Not Found")
=== modified file 'lib/lp/services/config/tests/test_config_lookup.py'
--- lib/lp/services/config/tests/test_config_lookup.py 2018-01-02 15:23:24 +0000
+++ lib/lp/services/config/tests/test_config_lookup.py 2018-01-02 16:24:23 +0000
@@ -113,7 +113,7 @@
def test_find_config_dir(self):
instance_config_dir = self.setUpInstanceConfig('an_instance')
- self.assertEquals(
+ self.assertEqual(
instance_config_dir, config.find_config_dir('an_instance'))
def test_Config_uses_find_config_dir(self):
@@ -127,7 +127,7 @@
# We don't care about ZConfig...
cfg._setZConfig = lambda: None
- self.assertEquals(2323, cfg.launchpad.default_batch_size)
+ self.assertEqual(2323, cfg.launchpad.default_batch_size)
class TestGenerateOverrides(ConfigTestCase):
=== modified file 'lib/lp/services/database/tests/test_storm.py'
--- lib/lp/services/database/tests/test_storm.py 2014-01-30 15:04:06 +0000
+++ lib/lp/services/database/tests/test_storm.py 2018-01-02 16:24:23 +0000
@@ -13,6 +13,6 @@
class TestStorm(TestCase):
def test_has_cextensions(self):
"""Ensure Storm C extensions are being used."""
- self.assert_(
+ self.assertTrue(
storm.has_cextensions,
'Storm not running with C extensions')
=== modified file 'lib/lp/services/features/tests/test_flags.py'
--- lib/lp/services/features/tests/test_flags.py 2014-02-26 00:25:03 +0000
+++ lib/lp/services/features/tests/test_flags.py 2018-01-02 16:24:23 +0000
@@ -188,7 +188,7 @@
# no scopes need to be checked because it's just not in the database
# and there's no point checking
self.assertEqual({}, f._known_scopes._known)
- self.assertEquals([], call_log)
+ self.assertEqual([], call_log)
# however, this we have now negative-cached the flag
self.assertEqual(dict(unknown=None), f.usedFlags())
self.assertEqual(dict(), f.usedScopes())
@@ -215,14 +215,14 @@
def test_getAllRulesAsTuples(self):
source = self.makeSource()
source.setAllRules(test_rules_list)
- self.assertEquals(
+ self.assertEqual(
test_rules_list,
list(source.getAllRulesAsTuples()))
def test_getAllRulesAsText(self):
source = self.makeSource()
source.setAllRules(test_rules_list)
- self.assertEquals(
+ self.assertEqual(
"""\
%s\tbeta_user\t100\t%s
ui.icing\tnormal_user\t500\t5.0
@@ -241,7 +241,7 @@
flag1 default 100 gamma with spaces
flag2 default 0\ton
""")
- self.assertEquals({
+ self.assertEqual({
'flag1': [
('beta_user', 200, 'alpha'),
('default', 100, 'gamma with spaces'),
=== modified file 'lib/lp/services/features/tests/test_scopes.py'
--- lib/lp/services/features/tests/test_scopes.py 2012-01-01 02:58:52 +0000
+++ lib/lp/services/features/tests/test_scopes.py 2018-01-02 16:24:23 +0000
@@ -100,7 +100,7 @@
name = 'userslice:%d,%d' % (i, checks)
if scope.lookup(name):
matches.append(name)
- self.assertEquals(len(matches), 1, matches)
+ self.assertEqual(len(matches), 1, matches)
class TestUserSliceScopeIntegration(TestCaseWithFactory):
@@ -123,5 +123,5 @@
value=u'not_value'),
]):
with person_logged_in(person):
- self.assertEquals(getFeatureFlag('test_feature'), 'on')
- self.assertEquals(getFeatureFlag('test_not'), None)
+ self.assertEqual(getFeatureFlag('test_feature'), 'on')
+ self.assertEqual(getFeatureFlag('test_not'), None)
=== modified file 'lib/lp/services/features/tests/test_webapp.py'
--- lib/lp/services/features/tests/test_webapp.py 2012-01-01 02:58:52 +0000
+++ lib/lp/services/features/tests/test_webapp.py 2018-01-02 16:24:23 +0000
@@ -114,7 +114,7 @@
with CaptureOops() as capture:
request = LaunchpadTestRequest()
- self.assertEquals(getFeatureFlag('feature_name'), 'value')
+ self.assertEqual(getFeatureFlag('feature_name'), 'value')
# Simulate an oops here.
globalErrorUtility.raising(None, request=request)
@@ -122,5 +122,5 @@
oops = capture.oopses[0]
self.assertTrue('features.usedScopes' in oops)
self.assertTrue('features.usedFlags' in oops)
- self.assertEquals(oops['features.usedFlags'],
- u"{'feature_name': u'value'}")
+ self.assertEqual(
+ oops['features.usedFlags'], u"{'feature_name': u'value'}")
=== modified file 'lib/lp/services/librarian/tests/test_libraryfilealias.py'
--- lib/lp/services/librarian/tests/test_libraryfilealias.py 2012-01-01 02:58:52 +0000
+++ lib/lp/services/librarian/tests/test_libraryfilealias.py 2018-01-02 16:24:23 +0000
@@ -38,10 +38,10 @@
def test_file_is_closed_at_the_end_of_transaction(self):
"""Non-DB instance state should be reset on transaction boundaries."""
self.file_alias.open()
- self.assertEquals(self.text_content[0:4], self.file_alias.read(4))
+ self.assertEqual(self.text_content[0:4], self.file_alias.read(4))
# This should reset the file pointer.
transaction.commit()
# If the file pointer isn't reset, the next call to read() will return
# the remaining content. If it's reset, the file will be auto-opened
# and its whole content will be returned.
- self.assertEquals(self.text_content, self.file_alias.read())
+ self.assertEqual(self.text_content, self.file_alias.read())
=== modified file 'lib/lp/services/librarian/tests/test_smoketest.py'
--- lib/lp/services/librarian/tests/test_smoketest.py 2015-10-14 15:22:01 +0000
+++ lib/lp/services/librarian/tests/test_smoketest.py 2018-01-02 16:24:23 +0000
@@ -78,7 +78,7 @@
# the main function will return 0 (which will be used as the processes
# exit code to signal success).
with fake_urllib(GoodUrllib()):
- self.assertEquals(
+ self.assertEqual(
do_smoketest(self.fake_librarian, self.fake_librarian,
output=StringIO()),
0)
@@ -87,7 +87,7 @@
# If incorrect data is retrieved, the main function will return 1
# (which will be used as the processes exit code to signal an error).
with fake_urllib(BadUrllib()):
- self.assertEquals(
+ self.assertEqual(
do_smoketest(self.fake_librarian, self.fake_librarian,
output=StringIO()),
1)
@@ -97,7 +97,7 @@
# function will return 1 (which will be used as the processes exit
# code to signal an error).
with fake_urllib(ErrorUrllib()):
- self.assertEquals(
+ self.assertEqual(
do_smoketest(self.fake_librarian, self.fake_librarian,
output=StringIO()),
1)
=== modified file 'lib/lp/services/librarianserver/tests/test_gc.py'
--- lib/lp/services/librarianserver/tests/test_gc.py 2018-01-02 10:54:31 +0000
+++ lib/lp/services/librarianserver/tests/test_gc.py 2018-01-02 16:24:23 +0000
@@ -299,10 +299,10 @@
self.ztm.begin()
# Make sure the well expired f1 is still there, but has no content.
f1 = LibraryFileAlias.get(self.f1_id)
- self.assert_(f1.content is None)
+ self.assertIsNone(f1.content)
# f2 should still have content, as it isn't flagged for expiry.
f2 = LibraryFileAlias.get(self.f2_id)
- self.assert_(f2.content is not None)
+ self.assertIsNotNone(f2.content)
def test_ignoreRecentlyExpiredAliases(self):
# LibraryFileAlias records that have expired recently are not
@@ -323,10 +323,10 @@
# Make sure f1 is still there and has content. This ensures that
# our stay of execution is still working.
f1 = LibraryFileAlias.get(self.f1_id)
- self.assert_(f1.content is not None)
+ self.assertIsNotNone(f1.content)
# f2 should still have content, as it isn't flagged for expiry.
f2 = LibraryFileAlias.get(self.f2_id)
- self.assert_(f2.content is not None)
+ self.assertIsNotNone(f2.content)
def test_DeleteUnreferencedContent(self):
# Merge the duplicates. This creates an
@@ -677,13 +677,13 @@
librariangc.delete_unwanted_files(self.con)
# None of the rubbish we created has been touched.
- self.assert_(os.path.isdir(noisedir1_path))
- self.assert_(os.path.isdir(noisedir2_path))
- self.assert_(os.path.isdir(noisedir3_path))
- self.assert_(os.path.exists(noisefile1_path))
- self.assert_(os.path.exists(noisefile2_path))
- self.assert_(os.path.exists(noisefile3_path))
- self.assert_(os.path.exists(migrated_path))
+ self.assertTrue(os.path.isdir(noisedir1_path))
+ self.assertTrue(os.path.isdir(noisedir2_path))
+ self.assertTrue(os.path.isdir(noisedir3_path))
+ self.assertTrue(os.path.exists(noisefile1_path))
+ self.assertTrue(os.path.exists(noisefile2_path))
+ self.assertTrue(os.path.exists(noisefile3_path))
+ self.assertTrue(os.path.exists(migrated_path))
finally:
# We need to clean this up ourselves, as the standard librarian
# cleanup only removes files it knows where valid to avoid
=== modified file 'lib/lp/services/librarianserver/tests/test_swift.py'
--- lib/lp/services/librarianserver/tests/test_swift.py 2018-01-02 10:54:31 +0000
+++ lib/lp/services/librarianserver/tests/test_swift.py 2018-01-02 16:24:23 +0000
@@ -82,7 +82,7 @@
# Confirm that files exist on disk where we expect to find them.
for lfc in self.lfcs:
path = swift.filesystem_path(lfc.id)
- self.assert_(os.path.exists(path))
+ self.assertTrue(os.path.exists(path))
# Copy all the files into Swift.
swift.to_swift(log, remove_func=None)
@@ -90,7 +90,7 @@
# Confirm that files exist on disk where we expect to find them.
for lfc in self.lfcs:
path = swift.filesystem_path(lfc.id)
- self.assert_(os.path.exists(path))
+ self.assertTrue(os.path.exists(path))
# Confirm all the files are also in Swift.
swift_client = self.swift_fixture.connect()
@@ -113,7 +113,7 @@
# Confirm that files exist on disk where we expect to find them.
for lfc in self.lfcs:
path = swift.filesystem_path(lfc.id)
- self.assert_(os.path.exists(path))
+ self.assertTrue(os.path.exists(path))
# Copy all the files into Swift.
swift.to_swift(log, remove_func=swift.rename)
@@ -121,7 +121,7 @@
# Confirm that files exist on disk where we expect to find them.
for lfc in self.lfcs:
path = swift.filesystem_path(lfc.id) + '.migrated'
- self.assert_(os.path.exists(path))
+ self.assertTrue(os.path.exists(path))
# Confirm all the files are also in Swift.
swift_client = self.swift_fixture.connect()
@@ -144,7 +144,7 @@
# Confirm that files exist on disk where we expect to find them.
for lfc in self.lfcs:
path = swift.filesystem_path(lfc.id)
- self.assert_(os.path.exists(path))
+ self.assertTrue(os.path.exists(path))
# Migrate all the files into Swift.
swift.to_swift(log, remove_func=os.unlink)
@@ -200,7 +200,7 @@
# to be done in multiple chunks, but small enough that it is
# stored in Swift as a single object.
size = LibrarianStorage.CHUNK_SIZE * 50
- self.assert_(size > 1024 * 1024)
+ self.assertTrue(size > 1024 * 1024)
expected_content = ''.join(chr(i % 256) for i in range(0, size))
lfa_id = self.add_file('hello_bigboy.xls', expected_content)
lfc = IStore(LibraryFileAlias).get(LibraryFileAlias, lfa_id).content
@@ -222,7 +222,7 @@
# to be done in multiple chunks, but small enough that it is
# stored in Swift as a single object.
size = LibrarianStorage.CHUNK_SIZE * 50 + 1
- self.assert_(size > 1024 * 1024)
+ self.assertTrue(size > 1024 * 1024)
expected_content = ''.join(chr(i % 256) for i in range(0, size))
lfa_id = self.add_file('hello_bigboy.xls', expected_content)
lfc = IStore(LibraryFileAlias).get(LibraryFileAlias, lfa_id).content
@@ -241,7 +241,7 @@
# Generate a blob large enough that Swift requires us to store
# it as multiple objects plus a manifest.
size = LibrarianStorage.CHUNK_SIZE * 50
- self.assert_(size > 1024 * 1024)
+ self.assertTrue(size > 1024 * 1024)
expected_content = ''.join(chr(i % 256) for i in range(0, size))
lfa_id = self.add_file('hello_bigboy.xls', expected_content)
lfa = IStore(LibraryFileAlias).get(LibraryFileAlias, lfa_id)
=== modified file 'lib/lp/services/mail/tests/test_sendmail.py'
--- lib/lp/services/mail/tests/test_sendmail.py 2015-07-08 16:05:11 +0000
+++ lib/lp/services/mail/tests/test_sendmail.py 2018-01-02 16:24:23 +0000
@@ -270,8 +270,8 @@
'from@xxxxxxxxxxx', to_addresses,
subject, 'body', {'key': 'value'})
ctrl.send()
- self.assertEquals(fake_mailer.from_addr, 'bounces@xxxxxxxxxxxxx')
- self.assertEquals(fake_mailer.to_addr, to_addresses)
+ self.assertEqual(fake_mailer.from_addr, 'bounces@xxxxxxxxxxxxx')
+ self.assertEqual(fake_mailer.to_addr, to_addresses)
self.checkTimelineHasOneMailAction(ctl.timeline, subject=subject)
def test_sendmail_with_email_header(self):
@@ -290,16 +290,16 @@
message.add_header('To', 'dest@xxxxxxxxxxx')
with CaptureTimeline() as ctl:
sendmail.sendmail(message)
- self.assertEquals(fake_mailer.from_addr, 'bounces@xxxxxxxxxxxxx')
- self.assertEquals(fake_mailer.to_addr, ['dest@xxxxxxxxxxx'])
+ self.assertEqual(fake_mailer.from_addr, 'bounces@xxxxxxxxxxxxx')
+ self.assertEqual(fake_mailer.to_addr, ['dest@xxxxxxxxxxx'])
self.checkTimelineHasOneMailAction(ctl.timeline, subject=subject_str)
def checkTimelineHasOneMailAction(self, timeline, subject):
actions = timeline.actions
- self.assertEquals(len(actions), 1)
+ self.assertEqual(len(actions), 1)
a0 = actions[0]
- self.assertEquals(a0.category, 'sendmail')
- self.assertEquals(a0.detail, subject)
+ self.assertEqual(a0.category, 'sendmail')
+ self.assertEqual(a0.detail, subject)
self.assertIsInstance(a0.detail, basestring)
=== modified file 'lib/lp/services/oauth/tests/test_oauth.py'
--- lib/lp/services/oauth/tests/test_oauth.py 2016-01-26 15:14:01 +0000
+++ lib/lp/services/oauth/tests/test_oauth.py 2018-01-02 16:24:23 +0000
@@ -33,7 +33,7 @@
screen won't probably find the new request token on the slave store.
"""
zstorm = getUtility(IZStorm)
- self.assertEquals(
+ self.assertEqual(
'%s-%s' % (MAIN_STORE, MASTER_FLAVOR),
zstorm.get_name(self.class_._getStore()))
=== modified file 'lib/lp/services/oauth/tests/test_tokens.py'
--- lib/lp/services/oauth/tests/test_tokens.py 2016-01-26 15:14:01 +0000
+++ lib/lp/services/oauth/tests/test_tokens.py 2018-01-02 16:24:23 +0000
@@ -95,10 +95,10 @@
def test_getByKey(self):
token, _ = self.consumer.newRequestToken()
- self.assertEquals(token, self.tokens.getByKey(token.key))
+ self.assertEqual(token, self.tokens.getByKey(token.key))
def test_getByKey_returns_none_for_unused_key(self):
- self.assertEquals(None, self.tokens.getByKey(u"no-such-token"))
+ self.assertIsNone(self.tokens.getByKey(u"no-such-token"))
class TestRequestTokens(TestOAuth):
@@ -142,12 +142,10 @@
def test_getRequestToken_for_wrong_consumer_returns_none(self):
token_1, _ = self.consumer.newRequestToken()
consumer_2 = self.factory.makeOAuthConsumer()
- self.assertEquals(
- None, consumer_2.getRequestToken(token_1.key))
+ self.assertIsNone(consumer_2.getRequestToken(token_1.key))
def test_getRequestToken_for_nonexistent_key_returns_none(self):
- self.assertEquals(
- None, self.consumer.getRequestToken(u"no-such-token"))
+ self.assertIsNone(self.consumer.getRequestToken(u"no-such-token"))
def test_isSecretValid(self):
token, secret = self.consumer.newRequestToken()
@@ -161,16 +159,16 @@
now = datetime.now(pytz.timezone('UTC'))
self.assertTrue(request_token.is_reviewed)
- self.assertEquals(request_token.person, self.person)
- self.assertEquals(request_token.permission,
- OAuthPermission.WRITE_PUBLIC)
+ self.assertEqual(request_token.person, self.person)
+ self.assertEqual(request_token.permission,
+ OAuthPermission.WRITE_PUBLIC)
self.assertTrue(request_token.date_created <= now)
# By default, reviewing a token does not set a context or
# expiration date.
- self.assertEquals(request_token.context, None)
- self.assertEquals(request_token.date_expires, None)
+ self.assertIsNone(request_token.context)
+ self.assertIsNone(request_token.date_expires)
def test_token_review_as_unauthorized(self):
request_token, _ = self.consumer.newRequestToken()
@@ -179,8 +177,8 @@
# This token has been reviewed, but it may not be used for any
# purpose.
self.assertTrue(request_token.is_reviewed)
- self.assertEquals(request_token.permission,
- OAuthPermission.UNAUTHORIZED)
+ self.assertEqual(request_token.permission,
+ OAuthPermission.UNAUTHORIZED)
def test_review_with_expiration_date(self):
# A request token may be associated with an expiration date
@@ -189,7 +187,7 @@
request_token.review(
self.person, OAuthPermission.WRITE_PUBLIC,
date_expires=self.in_a_while)
- self.assertEquals(request_token.date_expires, self.in_a_while)
+ self.assertEqual(request_token.date_expires, self.in_a_while)
def test_review_with_expiration_date_in_the_past(self):
# The expiration date, like the permission and context, is
@@ -203,7 +201,7 @@
request_token.review(
self.person, OAuthPermission.WRITE_PUBLIC,
date_expires=self.a_long_time_ago)
- self.assertEquals(request_token.date_expires, self.a_long_time_ago)
+ self.assertEqual(request_token.date_expires, self.a_long_time_ago)
self.assertFalse(request_token.is_expired)
def _reviewed_token_for_context(self, context_factory):
@@ -220,21 +218,21 @@
# product.
token, name = self._reviewed_token_for_context(
self.factory.makeProduct)
- self.assertEquals(token.context.name, name)
+ self.assertEqual(token.context.name, name)
def test_review_with_project_group_context(self):
# When reviewing a request token, the context may be set to a
# project group.
token, name = self._reviewed_token_for_context(
self.factory.makeProject)
- self.assertEquals(token.context.name, name)
+ self.assertEqual(token.context.name, name)
def test_review_with_distrosourcepackage_context(self):
# When reviewing a request token, the context may be set to a
# distribution source package.
token, name = self._reviewed_token_for_context(
self.factory.makeDistributionSourcePackage)
- self.assertEquals(token.context.name, name)
+ self.assertEqual(token.context.name, name)
def test_expired_request_token_cant_be_reviewed(self):
"""An expired request token can't be reviewed."""
@@ -247,21 +245,21 @@
def test_get_request_tokens_for_person(self):
"""It's possible to get a person's request tokens."""
person = self.factory.makePerson()
- self.assertEquals(person.oauth_request_tokens.count(), 0)
+ self.assertEqual(person.oauth_request_tokens.count(), 0)
for i in range(0, 3):
self.factory.makeOAuthRequestToken(reviewed_by=person)
- self.assertEquals(person.oauth_request_tokens.count(), 3)
+ self.assertEqual(person.oauth_request_tokens.count(), 3)
def test_expired_request_token_disappears_from_list(self):
person = self.factory.makePerson()
- self.assertEquals(person.oauth_request_tokens.count(), 0)
+ self.assertEqual(person.oauth_request_tokens.count(), 0)
request_token = self.factory.makeOAuthRequestToken(reviewed_by=person)
- self.assertEquals(person.oauth_request_tokens.count(), 1)
+ self.assertEqual(person.oauth_request_tokens.count(), 1)
login_person(person)
request_token.date_expires = self.a_long_time_ago
- self.assertEquals(person.oauth_request_tokens.count(), 0)
+ self.assertEqual(person.oauth_request_tokens.count(), 0)
class TestAccessTokens(TestOAuth):
@@ -292,18 +290,17 @@
request_token, access_token, _ = (
self._exchange_request_token_for_access_token())
- self.assertEquals(request_token.consumer, access_token.consumer)
+ self.assertEqual(request_token.consumer, access_token.consumer)
# An access token inherits its permission from the request
# token that created it. But an access token's .permission is
# an AccessLevel object, not an OAuthPermission. The only real
# difference is that there's no AccessLevel corresponding to
# OAuthPermission.UNAUTHORIZED.
- self.assertEquals(
- access_token.permission, AccessLevel.WRITE_PRIVATE)
+ self.assertEqual(access_token.permission, AccessLevel.WRITE_PRIVATE)
- self.assertEquals(None, access_token.context)
- self.assertEquals(None, access_token.date_expires)
+ self.assertIsNone(access_token.context)
+ self.assertIsNone(access_token.date_expires)
def test_access_token_field_inheritance(self):
# Make sure that specific fields like context and expiration
@@ -314,15 +311,13 @@
self.person, OAuthPermission.WRITE_PRIVATE,
context=context, date_expires=self.in_a_while)
access_token, _ = request_token.createAccessToken()
- self.assertEquals(request_token.context, access_token.context)
- self.assertEquals(
- request_token.date_expires, access_token.date_expires)
+ self.assertEqual(request_token.context, access_token.context)
+ self.assertEqual(request_token.date_expires, access_token.date_expires)
def test_request_token_disappears_when_exchanged(self):
request_token, access_token, _ = (
self._exchange_request_token_for_access_token())
- self.assertEquals(
- None, self.consumer.getRequestToken(request_token.key))
+ self.assertIsNone(self.consumer.getRequestToken(request_token.key))
def test_cant_exchange_unreviewed_request_token(self):
# An unreviewed request token cannot be exchanged for an access token.
@@ -367,21 +362,21 @@
def test_get_access_tokens_for_person(self):
"""It's possible to get a person's access tokens."""
person = self.factory.makePerson()
- self.assertEquals(person.oauth_access_tokens.count(), 0)
+ self.assertEqual(person.oauth_access_tokens.count(), 0)
for i in range(0, 3):
self.factory.makeOAuthAccessToken(self.consumer, person)
- self.assertEquals(person.oauth_access_tokens.count(), 3)
+ self.assertEqual(person.oauth_access_tokens.count(), 3)
def test_expired_access_token_disappears_from_list(self):
person = self.factory.makePerson()
- self.assertEquals(person.oauth_access_tokens.count(), 0)
+ self.assertEqual(person.oauth_access_tokens.count(), 0)
access_token, _ = self.factory.makeOAuthAccessToken(
self.consumer, person)
- self.assertEquals(person.oauth_access_tokens.count(), 1)
+ self.assertEqual(person.oauth_access_tokens.count(), 1)
login_person(access_token.person)
access_token.date_expires = self.a_long_time_ago
- self.assertEquals(person.oauth_access_tokens.count(), 0)
+ self.assertEqual(person.oauth_access_tokens.count(), 0)
class TestHelperFunctions(TestOAuth):
@@ -394,11 +389,11 @@
# If there's no token for user/consumer key/permission/context,
# one is created.
person = self.factory.makePerson()
- self.assertEquals(person.oauth_access_tokens.count(), 0)
+ self.assertEqual(person.oauth_access_tokens.count(), 0)
oauth_access_token_for(
self.consumer.key, person, OAuthPermission.WRITE_PUBLIC,
self.context)
- self.assertEquals(person.oauth_access_tokens.count(), 1)
+ self.assertEqual(person.oauth_access_tokens.count(), 1)
def test_oauth_access_token_string_permission(self):
"""You can pass in a string instead of an OAuthPermission."""
=== modified file 'lib/lp/services/openid/tests/test_baseopenidstore.py'
--- lib/lp/services/openid/tests/test_baseopenidstore.py 2013-06-20 05:50:00 +0000
+++ lib/lp/services/openid/tests/test_baseopenidstore.py 2018-01-02 16:24:23 +0000
@@ -29,12 +29,12 @@
'handle', 'secret', 42, 600, 'HMAC-SHA1'))
db_assoc = IMasterStore(self.store.Association).get(
self.store.Association, (u'server-url\xA9', u'handle'))
- self.assertEquals(db_assoc.server_url, u'server-url\xA9')
- self.assertEquals(db_assoc.handle, u'handle')
- self.assertEquals(db_assoc.secret, 'secret')
- self.assertEquals(db_assoc.issued, 42)
- self.assertEquals(db_assoc.lifetime, 600)
- self.assertEquals(db_assoc.assoc_type, u'HMAC-SHA1')
+ self.assertEqual(db_assoc.server_url, u'server-url\xA9')
+ self.assertEqual(db_assoc.handle, u'handle')
+ self.assertEqual(db_assoc.secret, 'secret')
+ self.assertEqual(db_assoc.issued, 42)
+ self.assertEqual(db_assoc.lifetime, 600)
+ self.assertEqual(db_assoc.assoc_type, u'HMAC-SHA1')
def test_storeAssociation_update_existing(self):
self.store.storeAssociation('server-url', Association(
@@ -58,15 +58,15 @@
assoc = self.store.getAssociation('server-url', 'handle')
self.assertIsInstance(assoc, Association)
- self.assertEquals(assoc.handle, 'handle')
- self.assertEquals(assoc.secret, 'secret')
- self.assertEquals(assoc.issued, timestamp)
- self.assertEquals(assoc.lifetime, 600)
- self.assertEquals(assoc.assoc_type, 'HMAC-SHA1')
+ self.assertEqual(assoc.handle, 'handle')
+ self.assertEqual(assoc.secret, 'secret')
+ self.assertEqual(assoc.issued, timestamp)
+ self.assertEqual(assoc.lifetime, 600)
+ self.assertEqual(assoc.assoc_type, 'HMAC-SHA1')
def test_getAssociation_unknown(self):
assoc = self.store.getAssociation('server-url', 'unknown')
- self.assertEquals(assoc, None)
+ self.assertEqual(assoc, None)
def test_getAssociation_expired(self):
lifetime = 600
@@ -76,7 +76,7 @@
# The association is not returned because it is out of date.
# Further more, it is removed from the database.
assoc = self.store.getAssociation('server-url', 'handle')
- self.assertEquals(assoc, None)
+ self.assertEqual(assoc, None)
store = IMasterStore(self.store.Association)
db_assoc = store.get(
@@ -99,13 +99,13 @@
timestamp = int(time.time())
self.store.storeAssociation('server-url', Association(
'handle', 'secret', timestamp, 600, 'HMAC-SHA1'))
- self.assertEquals(
+ self.assertEqual(
self.store.removeAssociation('server-url', 'handle'), True)
- self.assertEquals(
+ self.assertEqual(
self.store.getAssociation('server-url', 'handle'), None)
def test_removeAssociation_unknown(self):
- self.assertEquals(
+ self.assertEqual(
self.store.removeAssociation('server-url', 'unknown'),
False)
@@ -141,7 +141,7 @@
self.store.storeAssociation('server-url', Association(
'handle2', 'secret', timestamp, 200, 'HMAC-SHA1'))
- self.assertEquals(self.store.cleanupAssociations(), 1)
+ self.assertEqual(self.store.cleanupAssociations(), 1)
# The second (non-expired) association is left behind.
self.assertNotEqual(
=== modified file 'lib/lp/services/profile/tests.py'
--- lib/lp/services/profile/tests.py 2013-04-10 09:12:32 +0000
+++ lib/lp/services/profile/tests.py 2018-01-02 16:24:23 +0000
@@ -209,7 +209,7 @@
self.pushProfilingConfig(profiling_allowed='True')
profile.start_request(self._get_start_event('/++profile++show/'))
self.assertIsInstance(profile._profilers.profiler, profile.Profiler)
- self.assertEquals(set(profile._profilers.actions), set(('show', )))
+ self.assertEqual(set(profile._profilers.actions), set(('show', )))
def test_optional_profiling_with_callgrind_request_starts_profiling(self):
# If profiling is allowed and a request with the "callgrind" marker
@@ -217,7 +217,7 @@
self.pushProfilingConfig(profiling_allowed='True')
profile.start_request(self._get_start_event('/++profile++callgrind/'))
self.assertIsInstance(profile._profilers.profiler, profile.Profiler)
- self.assertEquals(
+ self.assertEqual(
set(profile._profilers.actions), set(('callgrind', )))
def test_optional_profiling_with_log_request_starts_profiling(self):
@@ -226,7 +226,7 @@
self.pushProfilingConfig(profiling_allowed='True')
profile.start_request(self._get_start_event('/++profile++log/'))
self.assertIsInstance(profile._profilers.profiler, profile.Profiler)
- self.assertEquals(
+ self.assertEqual(
set(profile._profilers.actions), set(('callgrind', )))
def test_optional_profiling_with_combined_request_starts_profiling(self):
@@ -236,7 +236,7 @@
profile.start_request(
self._get_start_event('/++profile++callgrind&show/'))
self.assertIsInstance(profile._profilers.profiler, profile.Profiler)
- self.assertEquals(
+ self.assertEqual(
set(profile._profilers.actions), set(('callgrind', 'show')))
def test_optional_profiling_with_reversed_request_starts_profiling(self):
@@ -249,7 +249,7 @@
profile.start_request(
self._get_start_event('/++profile++show&callgrind'))
self.assertIsInstance(profile._profilers.profiler, profile.Profiler)
- self.assertEquals(
+ self.assertEqual(
set(profile._profilers.actions), set(('callgrind', 'show')))
def test_optional_profiling_with_pstats_request_starts_profiling(self):
@@ -260,7 +260,7 @@
self._get_start_event('/++profile++pstats/'))
self.assertIsInstance(profile._profilers.profiler,
profile.Profiler)
- self.assertEquals(set(profile._profilers.actions), set(('pstats',)))
+ self.assertEqual(set(profile._profilers.actions), set(('pstats',)))
def test_optional_profiling_with_log_pstats(self):
# If profiling is allowed and a request with the "log" and "pstats"
@@ -270,7 +270,7 @@
profile.start_request(
self._get_start_event('/++profile++log&pstats/'))
self.assertIsInstance(profile._profilers.profiler, profile.Profiler)
- self.assertEquals(
+ self.assertEqual(
set(profile._profilers.actions), set(('callgrind', 'pstats',)))
def test_optional_profiling_with_callgrind_pstats(self):
@@ -282,7 +282,7 @@
self._get_start_event('/++profile++pstats&callgrind/'))
self.assertIsInstance(profile._profilers.profiler,
profile.Profiler)
- self.assertEquals(
+ self.assertEqual(
set(profile._profilers.actions), set(('pstats', 'callgrind')))
def test_forced_profiling_registers_action(self):
@@ -291,7 +291,7 @@
profiling_allowed='True', profile_all_requests='True')
profile.start_request(self._get_start_event('/'))
self.assertIsInstance(profile._profilers.profiler, profile.Profiler)
- self.assertEquals(
+ self.assertEqual(
set(profile._profilers.actions), set(('callgrind', )))
def test_optional_profiling_with_wrong_request_helps(self):
@@ -300,7 +300,7 @@
self.pushProfilingConfig(profiling_allowed='True')
profile.start_request(self._get_start_event('/++profile++/'))
self.assertIs(getattr(profile._profilers, 'profiler', None), None)
- self.assertEquals(set(profile._profilers.actions), set(('help', )))
+ self.assertEqual(set(profile._profilers.actions), set(('help', )))
def test_forced_profiling_with_wrong_request_helps(self):
# If profiling is forced and a request with the marker URL segment
@@ -309,7 +309,7 @@
profiling_allowed='True', profile_all_requests='True')
profile.start_request(self._get_start_event('/++profile++/'))
self.assertIsInstance(profile._profilers.profiler, profile.Profiler)
- self.assertEquals(
+ self.assertEqual(
set(profile._profilers.actions), set(('help', 'callgrind')))
def test_memory_profile_start(self):
@@ -336,14 +336,14 @@
self.pushProfilingConfig(profiling_allowed='True')
profile.start_request(self._get_start_event('/++profile++sqltrace/'))
self.assertIs(getattr(profile._profilers, 'profiler', None), None)
- self.assertEquals(profile._profilers.actions, dict(sql=True))
+ self.assertEqual(profile._profilers.actions, dict(sql=True))
self.assertEqual([], da.stop_sql_logging())
def test_sql_start(self):
self.pushProfilingConfig(profiling_allowed='True')
profile.start_request(self._get_start_event('/++profile++sql/'))
self.assertIs(getattr(profile._profilers, 'profiler', None), None)
- self.assertEquals(profile._profilers.actions, dict(sql=False))
+ self.assertEqual(profile._profilers.actions, dict(sql=False))
self.assertEqual([], da.stop_sql_logging())
def test_sqltrace_filtered_start(self):
@@ -351,7 +351,7 @@
profile.start_request(self._get_start_event(
'/++profile++sqltrace:includes bugsubscription/'))
self.assertIs(getattr(profile._profilers, 'profiler', None), None)
- self.assertEquals(set(profile._profilers.actions), set(('sql', )))
+ self.assertEqual(set(profile._profilers.actions), set(('sql', )))
data = profile._profilers.actions['sql']
self.assertTrue(data['condition']('SELECT BUGSUBSCRIPTION FROM FOO'))
self.assertEqual([], da.stop_sql_logging())
@@ -665,7 +665,7 @@
self.pushProfilingConfig(profiling_allowed='True')
request = self.endRequest('/++profile++show/no-such-file',
KeyError('foo'))
- self.assertEquals(request.oops['type'], 'KeyError')
+ self.assertEqual(request.oops['type'], 'KeyError')
response = self.getAddedResponse(request)
self.assertIn('Exception-Type: KeyError', response)
self.assertCleanProfilerState()
@@ -696,7 +696,7 @@
self.assertTrue(profile._profilers.profiling)
self.assertIsInstance(
profile._profilers.profiler, profile.Profiler)
- self.assertEquals(
+ self.assertEqual(
set(('show', 'callgrind', 'memory_profile_start')),
set(profile._profilers.actions))
=== modified file 'lib/lp/services/session/tests/test_session.py'
--- lib/lp/services/session/tests/test_session.py 2013-06-20 05:50:00 +0000
+++ lib/lp/services/session/tests/test_session.py 2018-01-02 16:24:23 +0000
@@ -26,7 +26,7 @@
for cls in [SessionData, SessionPkgData]:
for obj in [cls, cls()]:
store = adapter(obj)
- self.assert_(
+ self.assertTrue(
'session' in store.get_database()._dsn,
'Unknown store returned adapting %r to %r'
% (obj, adapter))
=== modified file 'lib/lp/services/tests/test_utils.py'
--- lib/lp/services/tests/test_utils.py 2014-08-29 01:34:04 +0000
+++ lib/lp/services/tests/test_utils.py 2018-01-02 16:24:23 +0000
@@ -200,7 +200,7 @@
def function():
pass
function()
- self.assertEquals(['before', 'after'], calls)
+ self.assertEqual(['before', 'after'], calls)
def test_decorate_with_function(self):
# The original function is actually called when we call the result of
@@ -211,7 +211,7 @@
def function():
calls.append('foo')
function()
- self.assertEquals(['foo'], calls)
+ self.assertEqual(['foo'], calls)
def test_decorate_with_call_twice(self):
# A function decorated with decorate_with can be called twice.
@@ -222,7 +222,7 @@
calls.append('foo')
function()
function()
- self.assertEquals(['foo', 'foo'], calls)
+ self.assertEqual(['foo', 'foo'], calls)
def test_decorate_with_arguments(self):
# decorate_with passes through arguments.
@@ -232,7 +232,7 @@
def function(*args, **kwargs):
calls.append((args, kwargs))
function('foo', 'bar', qux=4)
- self.assertEquals([(('foo', 'bar'), {'qux': 4})], calls)
+ self.assertEqual([(('foo', 'bar'), {'qux': 4})], calls)
def test_decorate_with_name_and_docstring(self):
# decorate_with preserves function names and docstrings.
=== modified file 'lib/lp/services/twistedsupport/tests/test_processmonitor.py'
--- lib/lp/services/twistedsupport/tests/test_processmonitor.py 2018-01-02 10:54:31 +0000
+++ lib/lp/services/twistedsupport/tests/test_processmonitor.py 2018-01-02 16:24:23 +0000
@@ -370,7 +370,7 @@
d = run_process_with_timeout(('true',))
def check_success_result(result):
- self.assertEquals(result, None, "Success result is not None.")
+ self.assertEqual(result, None, "Success result is not None.")
d.addCallback(check_success_result)
return d
=== modified file 'lib/lp/services/verification/browser/tests/test_logintoken.py'
--- lib/lp/services/verification/browser/tests/test_logintoken.py 2016-11-03 15:07:36 +0000
+++ lib/lp/services/verification/browser/tests/test_logintoken.py 2018-01-02 16:24:23 +0000
@@ -70,9 +70,9 @@
harness.submit('cancel', {})
actions = harness.view.actions.byname
self.assertIn('field.actions.cancel', actions)
- self.assertEquals(actions['field.actions.cancel'].submitted(), True)
- self.assertEquals(harness.view.errors, [])
- self.assertEquals(harness.view.next_url, self.expected_next_url)
+ self.assertEqual(actions['field.actions.cancel'].submitted(), True)
+ self.assertEqual(harness.view.errors, [])
+ self.assertEqual(harness.view.next_url, self.expected_next_url)
class TestClaimTeamView(TestCaseWithFactory):
@@ -101,9 +101,9 @@
requester=self.claimer, requesteremail=None,
email=self.claimee_email, tokentype=LoginTokenType.TEAMCLAIM)
msgs = self._claimToken(token1)
- self.assertEquals([u'Team claimed successfully'], msgs)
+ self.assertEqual([u'Team claimed successfully'], msgs)
msgs = self._claimToken(token2)
- self.assertEquals(
+ self.assertEqual(
[u'claimee has already been converted to a team.'], msgs)
=== modified file 'lib/lp/services/verification/tests/test_token_creation.py'
--- lib/lp/services/verification/tests/test_token_creation.py 2014-09-01 10:20:01 +0000
+++ lib/lp/services/verification/tests/test_token_creation.py 2018-01-02 16:24:23 +0000
@@ -12,4 +12,4 @@
def test_length(self):
token = create_token(99)
- self.assertEquals(len(token), 99)
+ self.assertEqual(len(token), 99)
=== modified file 'lib/lp/services/webapp/tests/test_authentication.py'
--- lib/lp/services/webapp/tests/test_authentication.py 2014-06-27 07:58:42 +0000
+++ lib/lp/services/webapp/tests/test_authentication.py 2018-01-02 16:24:23 +0000
@@ -38,15 +38,15 @@
# included in the OAuth calculations.
headers = OAuthRequest._split_header(
'OAuth realm="foo", oauth_consumer_key="justtesting"')
- self.assertEquals(headers,
+ self.assertEqual(headers,
{'oauth_consumer_key': 'justtesting'})
headers = OAuthRequest._split_header(
'OAuth oauth_consumer_key="justtesting"')
- self.assertEquals(headers,
+ self.assertEqual(headers,
{'oauth_consumer_key': 'justtesting'})
headers = OAuthRequest._split_header(
'OAuth oauth_consumer_key="justtesting", realm="realm"')
- self.assertEquals(headers,
+ self.assertEqual(headers,
{'oauth_consumer_key': 'justtesting'})
=== modified file 'lib/lp/services/webapp/tests/test_authutility.py'
--- lib/lp/services/webapp/tests/test_authutility.py 2016-09-21 02:50:41 +0000
+++ lib/lp/services/webapp/tests/test_authutility.py 2018-01-02 16:24:23 +0000
@@ -91,8 +91,8 @@
def test_unauthenticatedPrincipal(self):
authsvc, request = self._make(None, None)
- self.assert_(isinstance(authsvc.unauthenticatedPrincipal(),
- UnauthenticatedPrincipal))
+ self.assertTrue(isinstance(authsvc.unauthenticatedPrincipal(),
+ UnauthenticatedPrincipal))
def test_unauthorized(self):
authsvc, request = self._make('bruce', 'test')
@@ -127,7 +127,7 @@
exception = self.assertRaises(
AssertionError, authsvc._authenticateUsingBasicAuth,
credentials, request)
- self.assertEquals(
+ self.assertEqual(
"Attempted to use basic auth when it is disabled",
str(exception))
finally:
=== modified file 'lib/lp/services/webapp/tests/test_batching.py'
--- lib/lp/services/webapp/tests/test_batching.py 2016-02-05 16:51:12 +0000
+++ lib/lp/services/webapp/tests/test_batching.py 2018-01-02 16:24:23 +0000
@@ -459,7 +459,7 @@
resultset = self.makeStormResultSet()
range_factory = StormRangeFactory(resultset, self.logError)
[where_clause] = range_factory.whereExpressions([Person.id], [1])
- self.assertEquals('(Person.id) > (1)', compile(where_clause))
+ self.assertEqual('(Person.id) > (1)', compile(where_clause))
def test_whereExpressions_desc(self):
"""For descending sort order, whereExpressions() returns the
@@ -469,7 +469,7 @@
range_factory = StormRangeFactory(resultset, self.logError)
[where_clause] = range_factory.whereExpressions(
[Desc(Person.id)], [1])
- self.assertEquals('(Person.id) < (1)', compile(where_clause))
+ self.assertEqual('(Person.id) < (1)', compile(where_clause))
def test_whereExpressions__two_sort_columns_asc_asc(self):
"""If the ascending sort columns c1, c2 and the memo values
@@ -483,7 +483,7 @@
range_factory = StormRangeFactory(resultset, self.logError)
[where_clause] = range_factory.whereExpressions(
[Person.id, Person.name], [1, 'foo'])
- self.assertEquals(
+ self.assertEqual(
"(Person.id, Person.name) > (1, E'foo')", compile(where_clause))
def test_whereExpressions__two_sort_columns_desc_desc(self):
@@ -498,7 +498,7 @@
range_factory = StormRangeFactory(resultset, self.logError)
[where_clause] = range_factory.whereExpressions(
[Desc(Person.id), Desc(Person.name)], [1, 'foo'])
- self.assertEquals(
+ self.assertEqual(
"(Person.id, Person.name) < (1, E'foo')", compile(where_clause))
def test_whereExpressions__two_sort_columns_asc_desc(self):
@@ -516,10 +516,10 @@
range_factory = StormRangeFactory(resultset, self.logError)
[where_clause_1, where_clause_2] = range_factory.whereExpressions(
[Person.id, Desc(Person.name)], [1, 'foo'])
- self.assertEquals(
+ self.assertEqual(
"Person.id = ? AND ((Person.name) < (E'foo'))",
compile(where_clause_1))
- self.assertEquals('(Person.id) > (1)', compile(where_clause_2))
+ self.assertEqual('(Person.id) > (1)', compile(where_clause_2))
def test_getSlice__forward_without_memo(self):
resultset = self.makeStormResultSet()
=== modified file 'lib/lp/services/webapp/tests/test_breadcrumbs.py'
--- lib/lp/services/webapp/tests/test_breadcrumbs.py 2015-08-04 11:17:11 +0000
+++ lib/lp/services/webapp/tests/test_breadcrumbs.py 2018-01-02 16:24:23 +0000
@@ -67,14 +67,14 @@
# Breadcrumb adapter will use 'mainsite' as the rootsite.
cookbook = Cookbook()
self.assertIs(cookbook.rootsite, None)
- self.assertEquals(Breadcrumb(cookbook).rootsite, 'mainsite')
+ self.assertEqual(Breadcrumb(cookbook).rootsite, 'mainsite')
def test_urldata_rootsite_is_honored(self):
# When a class' ICanonicalUrlData defines a rootsite, our Breadcrumb
# adapter will use it.
cookbook = Cookbook()
cookbook.rootsite = 'cooking'
- self.assertEquals(Breadcrumb(cookbook).rootsite, 'cooking')
+ self.assertEqual(Breadcrumb(cookbook).rootsite, 'cooking')
class TestExtraBreadcrumbForLeafPageOnHierarchyView(BaseBreadcrumbTestCase):
@@ -94,20 +94,20 @@
def test_non_default_page(self):
crumbs = self.getBreadcrumbsForObject(self.product, '+download')
downloads_url = "%s/+download" % self.product_url
- self.assertEquals(
+ self.assertEqual(
[self.product_url, downloads_url],
[crumb.url for crumb in crumbs])
- self.assertEquals(
+ self.assertEqual(
'%s project files' % self.product.displayname,
crumbs[-1].text)
def test_facet_default_page(self):
crumbs = self.getBreadcrumbsForObject(self.product, '+bugs')
bugs_url = self.product_url.replace('launchpad', 'bugs.launchpad')
- self.assertEquals(
+ self.assertEqual(
[self.product_url, bugs_url],
[crumb.url for crumb in crumbs])
- self.assertEquals('Bugs', crumbs[-1].text)
+ self.assertEqual('Bugs', crumbs[-1].text)
def test_zope_i18n_Messages_are_interpolated(self):
# Views can use zope.i18nmessageid.Message as their title when they
@@ -124,7 +124,7 @@
request.traversed_objects = [self.product, test_view]
hierarchy_view = Hierarchy(test_view, request)
[breadcrumb] = hierarchy_view.makeBreadcrumbsForRequestedPage()
- self.assertEquals(breadcrumb.text, 'breadcrumb test')
+ self.assertEqual(breadcrumb.text, 'breadcrumb test')
class TestExtraFacetBreadcrumbsOnHierarchyView(BaseBreadcrumbTestCase):
@@ -151,14 +151,14 @@
def test_root_on_mainsite(self):
crumbs = self.getBreadcrumbsForUrl('http://launchpad.dev/')
- self.assertEquals(crumbs, [])
+ self.assertEqual(crumbs, [])
def test_product_on_mainsite(self):
self.assertBreadcrumbUrls([self.product_url], self.product)
def test_root_on_vhost(self):
crumbs = self.getBreadcrumbsForUrl('http://bugs.launchpad.dev/')
- self.assertEquals(crumbs, [])
+ self.assertEqual(crumbs, [])
def test_product_on_vhost(self):
self.assertBreadcrumbUrls(
=== modified file 'lib/lp/services/webapp/tests/test_error.py'
--- lib/lp/services/webapp/tests/test_error.py 2017-01-13 13:35:31 +0000
+++ lib/lp/services/webapp/tests/test_error.py 2018-01-02 16:24:23 +0000
@@ -56,17 +56,16 @@
def test_without_oops_id(self):
request = LaunchpadTestRequest()
SystemErrorView(Exception(), request)
- self.assertEquals(500, request.response.getStatus())
- self.assertEquals(
- None,
+ self.assertEqual(500, request.response.getStatus())
+ self.assertIsNone(
request.response.getHeader('X-Lazr-OopsId', literal=True))
def test_with_oops_id(self):
request = LaunchpadTestRequest()
request.oopsid = 'OOPS-1X1'
SystemErrorView(Exception(), request)
- self.assertEquals(500, request.response.getStatus())
- self.assertEquals(
+ self.assertEqual(500, request.response.getStatus())
+ self.assertEqual(
'OOPS-1X1',
request.response.getHeader('X-Lazr-OopsId', literal=True))
@@ -224,7 +223,7 @@
def test_disconnectionerror_view(self):
request = LaunchpadTestRequest()
DisconnectionErrorView(DisconnectionError(), request)
- self.assertEquals(503, request.response.getStatus())
+ self.assertEqual(503, request.response.getStatus())
def test_operationalerror_view_integration(self):
# Test setup.
@@ -246,4 +245,4 @@
def test_operationalerror_view(self):
request = LaunchpadTestRequest()
OperationalErrorView(OperationalError(), request)
- self.assertEquals(503, request.response.getStatus())
+ self.assertEqual(503, request.response.getStatus())
=== modified file 'lib/lp/services/webapp/tests/test_haproxy.py'
--- lib/lp/services/webapp/tests/test_haproxy.py 2012-09-28 06:01:02 +0000
+++ lib/lp/services/webapp/tests/test_haproxy.py 2018-01-02 16:24:23 +0000
@@ -32,7 +32,7 @@
def test_HAProxyStatusView_all_good_returns_200(self):
result = self.http(u'GET /+haproxy HTTP/1.0', handle_errors=False)
- self.assertEquals(200, result.getStatus())
+ self.assertEqual(200, result.getStatus())
def test_authenticated_HAProxyStatusView_works(self):
# We don't use authenticated requests, but this keeps us from
@@ -41,12 +41,12 @@
u'GET /+haproxy HTTP/1.0\n'
u'Authorization: Basic Zm9vLmJhckBjYW5vbmljYWwuY29tOnRlc3Q=\n',
handle_errors=False)
- self.assertEquals(200, result.getStatus())
+ self.assertEqual(200, result.getStatus())
def test_HAProxyStatusView_going_down_returns_500(self):
haproxy.set_going_down_flag(True)
result = self.http(u'GET /+haproxy HTTP/1.0', handle_errors=False)
- self.assertEquals(500, result.getStatus())
+ self.assertEqual(500, result.getStatus())
def test_haproxy_url_uses_DatabaseBlocked_policy(self):
request = LaunchpadTestRequest(environ={'PATH_INFO': '/+haproxy'})
@@ -56,9 +56,9 @@
def test_switch_going_down_flag(self):
haproxy.set_going_down_flag(True)
haproxy.switch_going_down_flag()
- self.assertEquals(False, haproxy.going_down_flag)
+ self.assertEqual(False, haproxy.going_down_flag)
haproxy.switch_going_down_flag()
- self.assertEquals(True, haproxy.going_down_flag)
+ self.assertEqual(True, haproxy.going_down_flag)
def test_HAProxyStatusView_status_code_is_configurable(self):
config.push('change_haproxy_status_code', dedent('''
@@ -68,4 +68,4 @@
self.addCleanup(config.pop, 'change_haproxy_status_code')
haproxy.set_going_down_flag(True)
result = self.http(u'GET /+haproxy HTTP/1.0', handle_errors=False)
- self.assertEquals(499, result.getStatus())
+ self.assertEqual(499, result.getStatus())
=== modified file 'lib/lp/services/webapp/tests/test_login.py'
--- lib/lp/services/webapp/tests/test_login.py 2016-05-27 09:57:43 +0000
+++ lib/lp/services/webapp/tests/test_login.py 2018-01-02 16:24:23 +0000
@@ -242,9 +242,9 @@
person.account, email=test_email)
self.assertTrue(view.login_called)
response = view.request.response
- self.assertEquals(httplib.TEMPORARY_REDIRECT, response.getStatus())
- self.assertEquals(view.request.form['starting_url'],
- response.getHeader('Location'))
+ self.assertEqual(httplib.TEMPORARY_REDIRECT, response.getStatus())
+ self.assertEqual(view.request.form['starting_url'],
+ response.getHeader('Location'))
# The 'last_write' flag was not updated (unlike in the other test
# methods) because in this case we didn't have to create a
# Person/Account entry, so it's ok for further requests to hit the
@@ -267,7 +267,7 @@
'starting_url': 'http://launchpad.dev/after-login',
'foo': 'bar',
}
- self.assertEquals(params, expected_params)
+ self.assertEqual(params, expected_params)
def test_gather_params_with_unicode_data(self):
# If the currently requested URL includes a query string, the
@@ -281,7 +281,7 @@
environ={'PATH_INFO': '/'})
view = OpenIDCallbackView(context=None, request=None)
params = view._gather_params(request)
- self.assertEquals(params['foo'], u'\u16dd')
+ self.assertEqual(params['foo'], u'\u16dd')
def test_unexpected_multivalue_fields(self):
# The parameter gatering doesn't expect to find multi-valued form
@@ -303,7 +303,7 @@
form={'starting_url': 'http://launchpad.dev/after-login'})
view = OpenIDCallbackView(context=None, request=None)
url = view._get_requested_url(request)
- self.assertEquals(url, 'http://example.com?foo=bar')
+ self.assertEqual(url, 'http://example.com?foo=bar')
def test_open_id_callback_handles_query_string(self):
# If the currently requested URL includes a query string, the
@@ -317,13 +317,13 @@
environ={'PATH_INFO': '/'})
view = FakeConsumerOpenIDCallbackView(object(), request)
view.initialize()
- self.assertEquals(
+ self.assertEqual(
view.fake_consumer.params,
{
'starting_url': 'http://launchpad.dev/after-login',
'foo': 'bar',
})
- self.assertEquals(
+ self.assertEqual(
view.fake_consumer.requested_url, 'http://example.com?foo=bar')
def test_unseen_identity(self):
@@ -343,12 +343,12 @@
self.assertTrue(view.login_called)
account = account_set.getByOpenIDIdentifier(identifier)
self.assertIsNot(None, account)
- self.assertEquals(AccountStatus.ACTIVE, account.status)
+ self.assertEqual(AccountStatus.ACTIVE, account.status)
person = IPerson(account, None)
self.assertIsNot(None, person)
- self.assertEquals('Foo User', person.displayname)
- self.assertEquals('non-existent@xxxxxxxxxxx',
- removeSecurityProxy(person.preferredemail).email)
+ self.assertEqual('Foo User', person.displayname)
+ self.assertEqual('non-existent@xxxxxxxxxxx',
+ removeSecurityProxy(person.preferredemail).email)
# We also update the last_write flag in the session, to make sure
# further requests use the master DB and thus see the newly created
@@ -382,12 +382,12 @@
identifiers = [i.identifier for i in account.openid_identifiers]
self.assertIn(identifier, identifiers)
- self.assertEquals(AccountStatus.ACTIVE, account.status)
- self.assertEquals(
+ self.assertEqual(AccountStatus.ACTIVE, account.status)
+ self.assertEqual(
email, removeSecurityProxy(person.preferredemail).email)
person = IPerson(account, None)
self.assertIsNot(None, person)
- self.assertEquals('Test account', person.displayname)
+ self.assertEqual('Test account', person.displayname)
# We also update the last_write flag in the session, to make sure
# further requests use the master DB and thus see the newly created
@@ -411,11 +411,11 @@
view, html = self._createAndRenderView(openid_response)
self.assertTrue(view.login_called)
response = view.request.response
- self.assertEquals(httplib.TEMPORARY_REDIRECT, response.getStatus())
- self.assertEquals(view.request.form['starting_url'],
- response.getHeader('Location'))
- self.assertEquals(AccountStatus.ACTIVE, person.account.status)
- self.assertEquals(email, person.preferredemail.email)
+ self.assertEqual(httplib.TEMPORARY_REDIRECT, response.getStatus())
+ self.assertEqual(view.request.form['starting_url'],
+ response.getHeader('Location'))
+ self.assertEqual(AccountStatus.ACTIVE, person.account.status)
+ self.assertEqual(email, person.preferredemail.email)
# We also update the last_write flag in the session, to make sure
# further requests use the master DB and thus see the newly created
# stuff.
@@ -440,8 +440,8 @@
with SRegResponse_fromSuccessResponse_stubbed():
view, html = self._createAndRenderView(openid_response)
self.assertTrue(view.login_called)
- self.assertEquals(AccountStatus.ACTIVE, person.account.status)
- self.assertEquals(email, person.preferredemail.email)
+ self.assertEqual(AccountStatus.ACTIVE, person.account.status)
+ self.assertEqual(email, person.preferredemail.email)
# We also update the last_write flag in the session, to make sure
# further requests use the master DB and thus see the newly created
# stuff.
@@ -579,9 +579,9 @@
view_class=StubbedOpenIDCallbackViewLoggedIn)
self.assertFalse(view.login_called)
response = view.request.response
- self.assertEquals(httplib.TEMPORARY_REDIRECT, response.getStatus())
- self.assertEquals(view.request.form['starting_url'],
- response.getHeader('Location'))
+ self.assertEqual(httplib.TEMPORARY_REDIRECT, response.getStatus())
+ self.assertEqual(view.request.form['starting_url'],
+ response.getHeader('Location'))
notification_msg = view.request.response.notifications[0].message
expected_msg = ('Your authentication failed but you were already '
'logged into Launchpad')
@@ -626,9 +626,9 @@
form={'starting_url': self.STARTING_URL})
view.initialize()
view._redirect()
- self.assertEquals(
+ self.assertEqual(
httplib.TEMPORARY_REDIRECT, view.request.response.getStatus())
- self.assertEquals(
+ self.assertEqual(
view.request.response.getHeader('Location'), self.STARTING_URL)
def test_open_id_callback_redirect_from_post(self):
@@ -640,9 +640,9 @@
QUERY_STRING='starting_url=' + self.STARTING_URL)
view.initialize()
view._redirect()
- self.assertEquals(
+ self.assertEqual(
httplib.TEMPORARY_REDIRECT, view.request.response.getStatus())
- self.assertEquals(
+ self.assertEqual(
view.request.response.getHeader('Location'), self.STARTING_URL)
def test_openid_callback_redirect_fallback(self):
@@ -652,9 +652,9 @@
view.request = LaunchpadTestRequest(SERVER_URL=self.APPLICATION_URL)
view.initialize()
view._redirect()
- self.assertEquals(
+ self.assertEqual(
httplib.TEMPORARY_REDIRECT, view.request.response.getStatus())
- self.assertEquals(
+ self.assertEqual(
view.request.response.getHeader('Location'), self.APPLICATION_URL)
@@ -694,7 +694,7 @@
self.assertIn('body onload', browser.contents)
browser.getControl('Continue').click()
- self.assertEquals('Login', browser.title)
+ self.assertEqual('Login', browser.title)
fill_login_form_and_submit(browser, 'test@xxxxxxxxxxxxx')
login_status = extract_text(
find_tag_by_id(browser.contents, 'logincontrol'))
@@ -710,10 +710,10 @@
replay_browser.open(callback_url)
login_status = extract_text(
find_tag_by_id(replay_browser.contents, 'logincontrol'))
- self.assertEquals('Log in / Register', login_status)
+ self.assertEqual('Log in / Register', login_status)
error_msg = find_tags_by_class(replay_browser.contents, 'error')[0]
- self.assertEquals('Nonce already used or out of range',
- extract_text(error_msg))
+ self.assertEqual('Nonce already used or out of range',
+ extract_text(error_msg))
class FakeHTTPResponse:
@@ -743,8 +743,8 @@
browser = TestBrowser()
self.assertRaises(urllib2.HTTPError,
browser.open, 'http://launchpad.dev/+login')
- self.assertEquals('503 Service Unavailable',
- browser.headers.get('status'))
+ self.assertEqual('503 Service Unavailable',
+ browser.headers.get('status'))
self.assertTrue(
'OpenID Provider Is Unavailable at This Time' in browser.contents)
@@ -845,10 +845,10 @@
self.assertIsNot(None, extensions)
sreg_extension = extensions[0]
self.assertIsInstance(sreg_extension, sreg.SRegRequest)
- self.assertEquals(['email', 'fullname'],
- sorted(sreg_extension.allRequestedFields()))
- self.assertEquals(sorted(sreg_extension.required),
- sorted(sreg_extension.allRequestedFields()))
+ self.assertEqual(['email', 'fullname'],
+ sorted(sreg_extension.allRequestedFields()))
+ self.assertEqual(sorted(sreg_extension.required),
+ sorted(sreg_extension.allRequestedFields()))
def test_pape_extension_added_with_reauth_query(self):
# We can signal that a request should be reauthenticated via
@@ -928,8 +928,8 @@
# At this point browser.contents contains a hidden form which would've
# been auto-submitted if we had in-browser JS support, but since we
# don't we can easily inspect what's in the form.
- self.assertEquals('%s/' % browser.rooturl,
- browser.getControl(name='openid.realm').value)
+ self.assertEqual('%s/' % browser.rooturl,
+ browser.getControl(name='openid.realm').value)
def test_realm_for_vhosts(self):
browser = Browser()
@@ -937,9 +937,9 @@
# At this point browser.contents contains a hidden form which would've
# been auto-submitted if we had in-browser JS support, but since we
# don't we can easily inspect what's in the form.
- self.assertEquals('%s'
- % self.layer.appserver_root_url(ensureSlash=True),
- browser.getControl(name='openid.realm').value)
+ self.assertEqual('%s'
+ % self.layer.appserver_root_url(ensureSlash=True),
+ browser.getControl(name='openid.realm').value)
def test_suite():
=== modified file 'lib/lp/services/webapp/tests/test_login_account.py'
--- lib/lp/services/webapp/tests/test_login_account.py 2018-01-02 10:54:31 +0000
+++ lib/lp/services/webapp/tests/test_login_account.py 2018-01-02 16:24:23 +0000
@@ -119,23 +119,22 @@
# The view should have redirected us, with no actual response body.
- self.assertEquals(self.request.response.getStatus(), 302)
- self.assertEquals(result, '')
+ self.assertEqual(self.request.response.getStatus(), 302)
+ self.assertEqual(result, '')
# We are redirecting to Loggerhead, to ask it to logout.
location = lazr.uri.URI(self.request.response.getHeader('location'))
- self.assertEquals(location.host, 'bazaar.launchpad.dev')
- self.assertEquals(location.scheme, 'https')
- self.assertEquals(location.path, '/+logout')
+ self.assertEqual(location.host, 'bazaar.launchpad.dev')
+ self.assertEqual(location.scheme, 'https')
+ self.assertEqual(location.path, '/+logout')
# That page should then redirect to our OpenId provider to logout,
# which we provide in our query string. See
# launchpad_loggerhead.tests.TestLogout for the pertinent tests.
query = cgi.parse_qs(location.query)
- self.assertEquals(
- query['next_to'][0], 'http://testopenid.dev/+logout')
+ self.assertEqual(query['next_to'][0], 'http://testopenid.dev/+logout')
def test_logging_in_and_logging_out_the_old_way(self):
# A test showing that we can authenticate a request that had the
=== modified file 'lib/lp/services/webapp/tests/test_menu.py'
--- lib/lp/services/webapp/tests/test_menu.py 2013-02-06 04:22:43 +0000
+++ lib/lp/services/webapp/tests/test_menu.py 2018-01-02 16:24:23 +0000
@@ -51,17 +51,17 @@
newInteraction()
menu = TestMenu(object())
menu._get_link('test_link')
- self.assertEquals(menu.times_called, 1)
+ self.assertEqual(menu.times_called, 1)
menu._get_link('test_link')
- self.assertEquals(menu.times_called, 2)
+ self.assertEqual(menu.times_called, 2)
def test_cache_when_there_is_a_request(self):
login(ANONYMOUS)
menu = TestMenu(object())
menu._get_link('test_link')
- self.assertEquals(menu.times_called, 1)
+ self.assertEqual(menu.times_called, 1)
menu._get_link('test_link')
- self.assertEquals(menu.times_called, 1)
+ self.assertEqual(menu.times_called, 1)
def test_correct_value_is_cached(self):
login(ANONYMOUS)
@@ -69,7 +69,7 @@
link = menu._get_link('test_link')
request = get_current_browser_request()
cache = request.annotations.get(MENU_ANNOTATION_KEY)
- self.assertEquals([link], cache.values())
+ self.assertEqual([link], cache.values())
def test_cache_key_is_unique(self):
# The cache key must include the link name, the context of the link
@@ -80,6 +80,6 @@
menu._get_link('test_link')
cache = get_current_browser_request().annotations.get(
MENU_ANNOTATION_KEY)
- self.assertEquals(len(cache.keys()), 1)
+ self.assertEqual(len(cache.keys()), 1)
self.assertContentEqual(
cache.keys()[0], (menu.__class__, context, 'test_link'))
=== modified file 'lib/lp/services/webapp/tests/test_pgsession.py'
--- lib/lp/services/webapp/tests/test_pgsession.py 2018-01-02 10:54:31 +0000
+++ lib/lp/services/webapp/tests/test_pgsession.py 2018-01-02 16:24:23 +0000
@@ -158,7 +158,7 @@
result = store.execute(
"SELECT client_id FROM SessionData ORDER BY client_id")
client_ids = [row[0] for row in result]
- self.assertEquals(client_ids, [hashlib.sha256(client_id).hexdigest()])
+ self.assertEqual(client_ids, [hashlib.sha256(client_id).hexdigest()])
# The session cookie also is now set, via the same "trigger".
self.assertNotEqual(
=== modified file 'lib/lp/services/webapp/tests/test_publication.py'
--- lib/lp/services/webapp/tests/test_publication.py 2018-01-02 10:54:31 +0000
+++ lib/lp/services/webapp/tests/test_publication.py 2018-01-02 16:24:23 +0000
@@ -69,7 +69,7 @@
publication = LaunchpadBrowserPublication(None)
publication.callTraversalHooks(request, obj1)
publication.callTraversalHooks(request, obj2)
- self.assertEquals(request.traversed_objects, [obj1, obj2])
+ self.assertEqual(request.traversed_objects, [obj1, obj2])
def test_callTraversalHooks_appends_only_once_to_traversed_objects(self):
# callTraversalHooks() may be called more than once for a given
@@ -80,7 +80,7 @@
publication = LaunchpadBrowserPublication(None)
publication.callTraversalHooks(request, obj1)
publication.callTraversalHooks(request, obj2)
- self.assertEquals(request.traversed_objects, [obj1])
+ self.assertEqual(request.traversed_objects, [obj1])
class TestWebServicePublication(TestCaseWithFactory):
=== modified file 'lib/lp/services/webapp/tests/test_servers.py'
--- lib/lp/services/webapp/tests/test_servers.py 2018-01-02 15:23:24 +0000
+++ lib/lp/services/webapp/tests/test_servers.py 2018-01-02 16:24:23 +0000
@@ -111,11 +111,11 @@
factory = ApplicationServerSettingRequestFactory(
LaunchpadBrowserRequest, 'launchpad.dev', 'https', 443)
request = factory(StringIO.StringIO(), {'HTTP_HOST': 'launchpad.dev'})
- self.assertEquals(
+ self.assertEqual(
request.get('HTTPS'), 'on', "factory didn't set the HTTPS env")
# This is a sanity check ensuring that effect of this works as
# expected with the Zope request implementation.
- self.assertEquals(request.getURL(), 'https://launchpad.dev')
+ self.assertEqual(request.getURL(), 'https://launchpad.dev')
def test___call___should_not_set_HTTPS(self):
# Ensure that the factory doesn't put an HTTPS variable in the
@@ -123,7 +123,7 @@
factory = ApplicationServerSettingRequestFactory(
LaunchpadBrowserRequest, 'launchpad.dev', 'http', 80)
request = factory(StringIO.StringIO(), {})
- self.assertEquals(
+ self.assertEqual(
request.get('HTTPS'), None,
"factory should not have set HTTPS env")
@@ -170,7 +170,7 @@
# Necessary preamble and sanity check. We need to call
# the factory's canHandle() method with an appropriate
# WSGI environment before it can produce a request object for us.
- self.assert_(self.factory.canHandle(env),
+ self.assertTrue(self.factory.canHandle(env),
"Sanity check: The factory should be able to handle requests.")
wrapped_factory, publication_factory = self.factory()
@@ -192,7 +192,7 @@
web service.
"""
env = self.wsgi_env(self.non_api_path)
- self.assert_(self.factory.canHandle(env),
+ self.assertTrue(self.factory.canHandle(env),
"Sanity check: The factory should be able to handle requests.")
wrapped_factory, publication_factory = self.factory()
@@ -216,11 +216,11 @@
for method in allowed_methods:
env = self.wsgi_env(self.api_path, method)
- self.assert_(self.factory.canHandle(env),
- "Sanity check")
+ self.assertTrue(self.factory.canHandle(env), "Sanity check")
# Returns a tuple of (request_factory, publication_factory).
rfactory, pfactory = self.factory.checkRequest(env)
- self.assert_(rfactory is None,
+ self.assertIsNone(
+ rfactory,
"The '%s' HTTP method should be handled by the factory."
% method)
@@ -237,10 +237,11 @@
for method in denied_methods:
env = self.wsgi_env(self.non_api_path, method)
- self.assert_(self.factory.canHandle(env), "Sanity check")
+ self.assertTrue(self.factory.canHandle(env), "Sanity check")
# Returns a tuple of (request_factory, publication_factory).
rfactory, pfactory = self.factory.checkRequest(env)
- self.assert_(rfactory is not None,
+ self.assertIsNotNone(
+ rfactory,
"The '%s' HTTP method should be rejected by the factory."
% method)
@@ -352,7 +353,7 @@
def test_response_should_vary_based_on_content_type(self):
request = WebServiceClientRequest(StringIO.StringIO(''), {})
- self.assertEquals(
+ self.assertEqual(
request.response.getHeader('Vary'), 'Accept')
@@ -364,26 +365,26 @@
def test_baserequest_response_should_vary(self):
"""Test that our base response has a proper vary header."""
request = LaunchpadBrowserRequest(StringIO.StringIO(''), {})
- self.assertEquals(
+ self.assertEqual(
request.response.getHeader('Vary'), 'Cookie, Authorization')
def test_baserequest_response_should_vary_after_retry(self):
"""Test that our base response has a proper vary header."""
request = LaunchpadBrowserRequest(StringIO.StringIO(''), {})
retried_request = request.retry()
- self.assertEquals(
+ self.assertEqual(
retried_request.response.getHeader('Vary'),
'Cookie, Authorization')
def test_baserequest_security_headers(self):
response = LaunchpadBrowserRequest(StringIO.StringIO(''), {}).response
- self.assertEquals(
+ self.assertEqual(
response.getHeader('X-Frame-Options'), 'SAMEORIGIN')
- self.assertEquals(
+ self.assertEqual(
response.getHeader('X-Content-Type-Options'), 'nosniff')
- self.assertEquals(
+ self.assertEqual(
response.getHeader('X-XSS-Protection'), '1; mode=block')
- self.assertEquals(
+ self.assertEqual(
response.getHeader(
'Strict-Transport-Security'), 'max-age=15552000')
@@ -399,7 +400,7 @@
bad_path = 'fnord/trunk\xE4'
env = {'PATH_INFO': bad_path}
request = LaunchpadBrowserRequest(StringIO.StringIO(''), env)
- self.assertEquals(u'fnord/trunk\ufffd', request.getHeader('PATH_INFO'))
+ self.assertEqual(u'fnord/trunk\ufffd', request.getHeader('PATH_INFO'))
def test_request_with_invalid_query_string_recovers(self):
# When the query string has invalid utf-8, it is decoded with
@@ -591,8 +592,8 @@
# interfaces are passed to getNearest().
request = self.request
request.traversed_objects.extend([self.thing_set, self.thing])
- self.assertEquals(request.getNearest(IThing), (self.thing, IThing))
- self.assertEquals(
+ self.assertEqual(request.getNearest(IThing), (self.thing, IThing))
+ self.assertEqual(
request.getNearest(IThingSet), (self.thing_set, IThingSet))
def test_multiple_traversed_objects_with_common_interface(self):
@@ -601,13 +602,13 @@
thing2 = Thing()
self.request.traversed_objects.extend(
[self.thing_set, self.thing, thing2])
- self.assertEquals(self.request.getNearest(IThing), (thing2, IThing))
+ self.assertEqual(self.request.getNearest(IThing), (thing2, IThing))
def test_interface_not_traversed(self):
# If a particular interface has not been traversed, the tuple
# (None, None) is returned.
self.request.traversed_objects.extend([self.thing_set])
- self.assertEquals(self.request.getNearest(IThing), (None, None))
+ self.assertEqual(self.request.getNearest(IThing), (None, None))
class TestLaunchpadBrowserRequest(TestCase):
=== modified file 'lib/lp/services/webapp/tests/test_sighup.py'
--- lib/lp/services/webapp/tests/test_sighup.py 2012-01-01 02:58:52 +0000
+++ lib/lp/services/webapp/tests/test_sighup.py 2018-01-02 16:24:23 +0000
@@ -31,8 +31,8 @@
def test_sighup(self):
# Sending SIGHUP should switch the PID
os.kill(os.getpid(), signal.SIGHUP)
- self.assertEquals(not self.original_flag, haproxy.going_down_flag)
+ self.assertEqual(not self.original_flag, haproxy.going_down_flag)
# Sending again should switch again.
os.kill(os.getpid(), signal.SIGHUP)
- self.assertEquals(self.original_flag, haproxy.going_down_flag)
+ self.assertEqual(self.original_flag, haproxy.going_down_flag)
=== modified file 'lib/lp/services/webservice/tests/test_json.py'
--- lib/lp/services/webservice/tests/test_json.py 2012-01-01 02:58:52 +0000
+++ lib/lp/services/webservice/tests/test_json.py 2018-01-02 16:24:23 +0000
@@ -20,12 +20,12 @@
def test_toDataForJSON(self):
serializer = StrJSONSerializer(
timedelta(days=2, hours=2, seconds=5))
- self.assertEquals(
+ self.assertEqual(
'2 days, 2:00:05',
serializer.toDataForJSON('application/json'))
def test_timedelta_users_StrJSONSerializer(self):
delta = timedelta(seconds=5)
serializer = IJSONPublishable(delta)
- self.assertEquals('0:00:05',
+ self.assertEqual('0:00:05',
serializer.toDataForJSON('application/json'))
=== modified file 'lib/lp/services/worlddata/tests/test_language.py'
--- lib/lp/services/worlddata/tests/test_language.py 2018-01-02 10:54:31 +0000
+++ lib/lp/services/worlddata/tests/test_language.py 2018-01-02 16:24:23 +0000
@@ -69,8 +69,8 @@
def test_translators_count(self):
# translators_count works.
- self.assertEquals(3, self.translated_lang.translators_count)
- self.assertEquals(0, self.untranslated_lang.translators_count)
+ self.assertEqual(3, self.translated_lang.translators_count)
+ self.assertEqual(0, self.untranslated_lang.translators_count)
def test_translators_count_queries(self):
# translators_count issues a single query.
@@ -83,6 +83,6 @@
list(getUtility(ILanguageSet).getAllLanguages(
want_translators_count=True))
with StormStatementRecorder() as recorder:
- self.assertEquals(3, self.translated_lang.translators_count)
- self.assertEquals(0, self.untranslated_lang.translators_count)
+ self.assertEqual(3, self.translated_lang.translators_count)
+ self.assertEqual(0, self.untranslated_lang.translators_count)
self.assertThat(recorder, HasQueryCount(Equals(0)))
=== modified file 'lib/lp/soyuz/browser/tests/test_archive_packages.py'
--- lib/lp/soyuz/browser/tests/test_archive_packages.py 2017-10-21 18:14:14 +0000
+++ lib/lp/soyuz/browser/tests/test_archive_packages.py 2018-01-02 16:24:23 +0000
@@ -170,7 +170,7 @@
def test_specified_name_filter_works(self):
view = self.getPackagesView('field.name_filter=blah')
- self.assertEquals('blah', view.specified_name_filter)
+ self.assertEqual('blah', view.specified_name_filter)
def test_specified_name_filter_returns_none_on_omission(self):
view = self.getPackagesView()
@@ -382,7 +382,7 @@
attrs={'class': 'pending-job', 'job_id': job3.id}),
)
self.assertThat(html, packages_matches)
- self.assertEquals(
+ self.assertEqual(
[], BeautifulSoup(html).findAll(
'span', text=re.compile('Showing 5 of .')))
@@ -392,10 +392,10 @@
view = create_initialized_view(
self.archive, "+packages", principal=self.archive.owner)
soup = BeautifulSoup(view.render())
- self.assertEquals([],
+ self.assertEqual([],
soup.findAll(
'div', attrs={'class': 'pending-job', 'job_id': jobs[-1].id}))
- self.assertEquals(
+ self.assertEqual(
[u'Showing 5 of 7'],
soup.findAll('span', text=re.compile('Showing 5 of .')))
=== modified file 'lib/lp/soyuz/browser/tests/test_breadcrumbs.py'
--- lib/lp/soyuz/browser/tests/test_breadcrumbs.py 2013-05-10 06:44:11 +0000
+++ lib/lp/soyuz/browser/tests/test_breadcrumbs.py 2018-01-02 16:24:23 +0000
@@ -26,23 +26,23 @@
def test_distroarchseries(self):
das_url = canonical_url(self.hoary_i386)
crumbs = self.getBreadcrumbsForObject(self.hoary_i386)
- self.assertEquals(crumbs[-1].url, das_url)
- self.assertEquals(crumbs[-1].text, "i386")
+ self.assertEqual(crumbs[-1].url, das_url)
+ self.assertEqual(crumbs[-1].text, "i386")
def test_distroarchseriesbinarypackage(self):
pmount_hoary_i386 = self.hoary_i386.getBinaryPackage("pmount")
pmount_url = canonical_url(pmount_hoary_i386)
crumbs = self.getBreadcrumbsForObject(pmount_hoary_i386)
- self.assertEquals(crumbs[-1].url, pmount_url)
- self.assertEquals(crumbs[-1].text, "pmount")
+ self.assertEqual(crumbs[-1].url, pmount_url)
+ self.assertEqual(crumbs[-1].text, "pmount")
def test_distroarchseriesbinarypackagerelease(self):
pmount_hoary_i386 = self.hoary_i386.getBinaryPackage("pmount")
pmount_release = pmount_hoary_i386['0.1-1']
pmount_release_url = canonical_url(pmount_release)
crumbs = self.getBreadcrumbsForObject(pmount_release)
- self.assertEquals(crumbs[-1].url, pmount_release_url)
- self.assertEquals(crumbs[-1].text, "0.1-1")
+ self.assertEqual(crumbs[-1].url, pmount_release_url)
+ self.assertEqual(crumbs[-1].text, "0.1-1")
class TestArchiveSubscriptionBreadcrumb(BaseBreadcrumbTestCase):
@@ -66,6 +66,6 @@
subscription_url = canonical_url(self.personal_archive_subscription)
crumbs = self.getBreadcrumbsForObject(
self.personal_archive_subscription)
- self.assertEquals(subscription_url, crumbs[-1].url)
- self.assertEquals(
+ self.assertEqual(subscription_url, crumbs[-1].url)
+ self.assertEqual(
"Access to %s" % self.ppa.displayname, crumbs[-1].text)
=== modified file 'lib/lp/soyuz/browser/tests/test_build_views.py'
--- lib/lp/soyuz/browser/tests/test_build_views.py 2016-01-26 15:47:37 +0000
+++ lib/lp/soyuz/browser/tests/test_build_views.py 2018-01-02 16:24:23 +0000
@@ -54,7 +54,7 @@
with person_logged_in(person):
build_view = getMultiAdapter(
(build, self.empty_request), name="+index")
- self.assertEquals(build_view.user_can_retry_build, expected)
+ self.assertEqual(build_view.user_can_retry_build, expected)
def test_view_with_component(self):
# The component name is provided when the component is known.
@@ -83,7 +83,7 @@
removeSecurityProxy(archive).require_virtualized = False
build = self.factory.makeBinaryPackageBuild(archive=archive)
build_menu = BuildContextMenu(build)
- self.assertEquals(
+ self.assertEqual(
build_menu.links,
['ppa', 'records', 'retry', 'rescore', 'cancel'])
self.assertFalse(build_menu.is_ppa_build)
@@ -99,7 +99,7 @@
build = self.factory.makeBinaryPackageBuild(archive=ppa)
build.queueBuild()
build_menu = BuildContextMenu(build)
- self.assertEquals(
+ self.assertEqual(
build_menu.links,
['ppa', 'records', 'retry', 'rescore', 'cancel'])
self.assertTrue(build_menu.is_ppa_build)
@@ -124,8 +124,8 @@
build_view = getMultiAdapter(
(build, self.empty_request), name="+index")
self.assertFalse(build_view.is_ppa)
- self.assertEquals(build_view.buildqueue, None)
- self.assertEquals(build_view.component_name, 'multiverse')
+ self.assertEqual(build_view.buildqueue, None)
+ self.assertEqual(build_view.component_name, 'multiverse')
self.assertFalse(build.can_be_retried)
self.assertFalse(build_view.user_can_retry_build)
@@ -185,23 +185,23 @@
build = self.factory.makeBinaryPackageBuild()
build_view = getMultiAdapter(
(build, self.empty_request), name="+index")
- self.assertEquals(build_view.package_upload, None)
+ self.assertEqual(build_view.package_upload, None)
self.assertFalse(build_view.has_published_binaries)
package_upload = build.distro_series.createQueueEntry(
PackagePublishingPocket.UPDATES, build.archive,
'changes.txt', 'my changes')
# Old SQL Object: creating it, adds it automatically to the store.
PackageUploadBuild(packageupload=package_upload, build=build)
- self.assertEquals(package_upload.status.name, 'NEW')
+ self.assertEqual(package_upload.status.name, 'NEW')
build_view = getMultiAdapter(
(build, self.empty_request), name="+index")
- self.assertEquals(build_view.package_upload.status.name, 'NEW')
+ self.assertEqual(build_view.package_upload.status.name, 'NEW')
self.assertFalse(build_view.has_published_binaries)
with person_logged_in(self.admin):
package_upload.setDone()
build_view = getMultiAdapter(
(build, self.empty_request), name="+index")
- self.assertEquals(build_view.package_upload.status.name, 'DONE')
+ self.assertEqual(build_view.package_upload.status.name, 'DONE')
self.assertTrue(build_view.has_published_binaries)
def test_build_view_files_helper(self):
@@ -213,13 +213,13 @@
bprf = self.factory.makeBinaryPackageFile(binarypackagerelease=bpr)
build_view = create_initialized_view(build, '+index')
deb_file = build_view.files[0]
- self.assertEquals(deb_file.filename, bprf.libraryfile.filename)
+ self.assertEqual(deb_file.filename, bprf.libraryfile.filename)
# Deleted files won't be included
self.assertFalse(deb_file.deleted)
removeSecurityProxy(deb_file.context).content = None
self.assertTrue(deb_file.deleted)
build_view = create_initialized_view(build, '+index')
- self.assertEquals(len(build_view.files), 0)
+ self.assertEqual(len(build_view.files), 0)
def test_build_rescoring_view(self):
# `BuildRescoringView` is used for setting new values to the
@@ -230,12 +230,12 @@
status=BuildStatus.FAILEDTOBUILD)
self.assertFalse(build.can_be_rescored)
view = create_initialized_view(build, name='+rescore')
- self.assertEquals(view.request.response.getStatus(), 302)
- self.assertEquals(view.request.response.getHeader('Location'),
+ self.assertEqual(view.request.response.getStatus(), 302)
+ self.assertEqual(view.request.response.getHeader('Location'),
canonical_url(build))
pending_build = self.factory.makeBinaryPackageBuild()
view = create_initialized_view(pending_build, name='+rescore')
- self.assertEquals(view.cancel_url, canonical_url(pending_build))
+ self.assertEqual(view.cancel_url, canonical_url(pending_build))
def test_rescore_value_too_large(self):
build = self.factory.makeBinaryPackageBuild()
@@ -243,8 +243,8 @@
build, name="+rescore", form={
'field.priority': str(2 ** 31 + 1),
'field.actions.rescore': 'Rescore'})
- self.assertEquals(view.errors[0].widget_title, "Priority")
- self.assertEquals(view.errors[0].doc(), "Value is too big")
+ self.assertEqual(view.errors[0].widget_title, "Priority")
+ self.assertEqual(view.errors[0].doc(), "Value is too big")
def test_rescore_value_too_small(self):
build = self.factory.makeBinaryPackageBuild()
@@ -252,8 +252,8 @@
build, name="+rescore", form={
'field.priority': '-' + str(2 ** 31 + 1),
'field.actions.rescore': 'Rescore'})
- self.assertEquals(view.errors[0].widget_title, "Priority")
- self.assertEquals(view.errors[0].doc(), "Value is too small")
+ self.assertEqual(view.errors[0].widget_title, "Priority")
+ self.assertEqual(view.errors[0].doc(), "Value is too small")
def test_rescore(self):
pending_build = self.factory.makeBinaryPackageBuild()
@@ -264,8 +264,8 @@
'field.priority': '0',
'field.actions.rescore': 'Rescore'})
notification = view.request.response.notifications[0]
- self.assertEquals(notification.message, "Build rescored to 0.")
- self.assertEquals(pending_build.buildqueue_record.lastscore, 0)
+ self.assertEqual(notification.message, "Build rescored to 0.")
+ self.assertEqual(pending_build.buildqueue_record.lastscore, 0)
def test_build_page_has_cancel_link(self):
build = self.factory.makeBinaryPackageBuild()
@@ -336,24 +336,24 @@
distroseries, name="+builds", form={'build_state': 'all'})
view.setupBuildList()
build_arches = [build.arch_tag for build in view.complete_builds]
- self.assertEquals(arch_list.sort(), build_arches.sort())
+ self.assertEqual(arch_list.sort(), build_arches.sort())
view = create_initialized_view(
distroseries, name="+builds", form={
'build_state': 'all', 'arch_tag': arch_list[0]})
view.setupBuildList()
- self.assertEquals(len(view.complete_builds), 1)
- self.assertEquals(view.complete_builds[0].arch_tag, arch_list[0])
+ self.assertEqual(len(view.complete_builds), 1)
+ self.assertEqual(view.complete_builds[0].arch_tag, arch_list[0])
# There is an extra entry for 'All architectures'
- self.assertEquals(len(view.architecture_options), len(arch_list) + 1)
+ self.assertEqual(len(view.architecture_options), len(arch_list) + 1)
selected = []
option_arches = []
for option in view.architecture_options:
option_arches.append(option['name'])
if option['selected'] is not None:
selected.append(option['name'])
- self.assertEquals(option_arches.sort(), arch_list.sort())
+ self.assertEqual(option_arches.sort(), arch_list.sort())
self.assertTrue(len(selected), 1)
- self.assertEquals(selected, [arch_list[0]])
+ self.assertEqual(selected, [arch_list[0]])
def test_dispatch_estimate(self):
# A dispatch time estimate is available for pending binary builds
@@ -363,11 +363,11 @@
view = create_initialized_view(build, name="+index")
bq = view.context.buildqueue_record
self.assertTrue(view.dispatch_time_estimate_available)
- self.assertEquals(view.context.status, BuildStatus.NEEDSBUILD)
- self.assertEquals(bq.status, BuildQueueStatus.WAITING)
+ self.assertEqual(view.context.status, BuildStatus.NEEDSBUILD)
+ self.assertEqual(bq.status, BuildQueueStatus.WAITING)
# If we suspend the job, there is no estimate available
bq.suspend()
- self.assertEquals(bq.status, BuildQueueStatus.SUSPENDED)
+ self.assertEqual(bq.status, BuildQueueStatus.SUSPENDED)
self.assertFalse(view.dispatch_time_estimate_available)
def test_old_url_redirection(self):
@@ -378,7 +378,7 @@
url = "http://launchpad.dev/+builds/+build/%s" % build.id
expected_url = canonical_url(build)
browser = self.getUserBrowser(url)
- self.assertEquals(expected_url, browser.url)
+ self.assertEqual(expected_url, browser.url)
def test_DistributionBuildRecordsView__range_factory(self):
# DistributionBuildRecordsView works with StormRangeFactory:
=== modified file 'lib/lp/soyuz/browser/tests/test_queue.py'
--- lib/lp/soyuz/browser/tests/test_queue.py 2017-02-12 09:34:50 +0000
+++ lib/lp/soyuz/browser/tests/test_queue.py 2018-01-02 16:24:23 +0000
@@ -173,7 +173,7 @@
request.method = 'POST'
view = self.setupQueueView(request)
- self.assertEquals(
+ self.assertEqual(
html_escape(
"FAILED: partner-upload (You have no rights to accept "
"component(s) 'partner')"),
@@ -221,7 +221,7 @@
request.method = 'POST'
view = self.setupQueueView(request)
- self.assertEquals(
+ self.assertEqual(
html_escape(
"FAILED: main-upload (You have no rights to accept "
"component(s) 'main')"),
=== modified file 'lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py'
--- lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py 2016-04-27 16:08:05 +0000
+++ lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py 2018-01-02 16:24:23 +0000
@@ -1276,12 +1276,12 @@
# The new series has been derived from previous_series.
published_sources = child.main_archive.getPublishedSources(
distroseries=child)
- self.assertEquals(2, published_sources.count())
+ self.assertEqual(2, published_sources.count())
pub_sources = sorted(
[(s.sourcepackagerelease.sourcepackagename.name,
s.sourcepackagerelease.version)
for s in published_sources])
- self.assertEquals(
+ self.assertEqual(
[(u'p1', u'1.2'), (u'p2', u'1.5')],
pub_sources)
@@ -1492,7 +1492,7 @@
source_package_name_str=u'p2')
dsd_source = getUtility(IDistroSeriesDifferenceSource)
# No DSDs for the child yet.
- self.assertEquals(0, dsd_source.getForDistroSeries(child).count())
+ self.assertEqual(0, dsd_source.getForDistroSeries(child).count())
self._fullInitialize([], child=child)
self.assertContentEqual(
=== modified file 'lib/lp/soyuz/scripts/tests/test_ppakeygenerator.py'
--- lib/lp/soyuz/scripts/tests/test_ppakeygenerator.py 2016-03-03 16:16:16 +0000
+++ lib/lp/soyuz/scripts/tests/test_ppakeygenerator.py 2018-01-02 16:24:23 +0000
@@ -102,7 +102,7 @@
key_generator.main()
self.assertTrue(cprov.archive.signing_key is not None)
- self.assertEquals(txn.commit_count, 1)
+ self.assertEqual(txn.commit_count, 1)
def testGenerateKeyForAllPPA(self):
"""Signing key generation for all PPAs.
@@ -123,4 +123,4 @@
for archive in archives:
self.assertTrue(archive.signing_key is not None)
- self.assertEquals(txn.commit_count, len(archives))
+ self.assertEqual(txn.commit_count, len(archives))
=== modified file 'lib/lp/soyuz/scripts/tests/test_ppareport.py'
--- lib/lp/soyuz/scripts/tests/test_ppareport.py 2014-07-24 09:37:03 +0000
+++ lib/lp/soyuz/scripts/tests/test_ppareport.py 2018-01-02 16:24:23 +0000
@@ -111,17 +111,17 @@
# objects representing the PPAs with active publications.
# Supports filtering by a specific PPA owner name.
reporter = self.getReporter()
- self.assertEquals(
+ self.assertEqual(
[ppa.owner.name for ppa in reporter.ppas],
['cprov', 'mark'])
reporter = self.getReporter(ppa_owner='cprov')
- self.assertEquals(
+ self.assertEqual(
[ppa.owner.name for ppa in reporter.ppas],
['cprov'])
reporter = self.getReporter(ppa_owner='foobar')
- self.assertEquals(
+ self.assertEqual(
[ppa.owner.name for ppa in reporter.ppas],
[])
@@ -133,7 +133,7 @@
reporter = self.getReporter()
reporter.setOutput()
reporter.reportOverQuota()
- self.assertEquals(
+ self.assertEqual(
reporter.output.getvalue().splitlines(), [
'= PPAs over 80.00% of their quota =',
'',
@@ -143,7 +143,7 @@
reporter = self.getReporter(quota_threshold=.01)
reporter.setOutput()
reporter.reportOverQuota()
- self.assertEquals(
+ self.assertEqual(
reporter.output.getvalue().splitlines(), [
'= PPAs over 0.01% of their quota =',
'http://launchpad.dev/~cprov/+archive/ubuntu/ppa | 1024 | 9',
@@ -158,7 +158,7 @@
reporter = self.getReporter()
reporter.setOutput()
reporter.reportUserEmails()
- self.assertEquals(
+ self.assertEqual(
reporter.output.getvalue().splitlines(), [
'= PPA user emails =',
'cprov | Celso Providelo | celso.providelo@xxxxxxxxxxxxx',
@@ -170,7 +170,7 @@
reporter = self.getReporter(ppa_owner='cprov')
reporter.setOutput()
reporter.reportUserEmails()
- self.assertEquals(
+ self.assertEqual(
reporter.output.getvalue().splitlines(), [
'= PPA user emails =',
'cprov | Celso Providelo | celso.providelo@xxxxxxxxxxxxx',
@@ -184,7 +184,7 @@
reporter = self.getReporter()
reporter.setOutput()
reporter.reportOrphanRepos()
- self.assertEquals(
+ self.assertEqual(
reporter.output.getvalue().splitlines(), [
'= Orphan PPA repositories =',
'',
@@ -198,7 +198,7 @@
reporter = self.getReporter()
reporter.setOutput()
reporter.reportOrphanRepos()
- self.assertEquals(
+ self.assertEqual(
reporter.output.getvalue().splitlines(), [
'= Orphan PPA repositories =',
'/var/tmp/ppa.test/orphan',
@@ -214,7 +214,7 @@
reporter = self.getReporter()
reporter.setOutput()
reporter.reportMissingRepos()
- self.assertEquals(
+ self.assertEqual(
reporter.output.getvalue().splitlines(), [
'= Missing PPA repositories =',
'/var/tmp/ppa.test/cprov',
@@ -234,7 +234,7 @@
reporter = self.getReporter()
reporter.setOutput()
reporter.reportMissingRepos()
- self.assertEquals(
+ self.assertEqual(
reporter.output.getvalue().splitlines(), [
'= Missing PPA repositories =',
'',
@@ -252,7 +252,7 @@
reporter = self.getReporter(
gen_missing_repos=True, output=output_path)
reporter.main()
- self.assertEquals(
+ self.assertEqual(
open(output_path).read().splitlines(), [
'= Missing PPA repositories =',
'/var/tmp/ppa.test/cprov',
@@ -269,7 +269,7 @@
gen_over_quota=True, gen_orphan_repos=True,
gen_missing_repos=True)
reporter.main()
- self.assertEquals(
+ self.assertEqual(
reporter.output.getvalue().splitlines(), [
'= PPAs over 80.00% of their quota =',
'',
@@ -283,7 +283,7 @@
# Another run for generating user emails report
reporter = self.getReporter(gen_user_emails=True)
reporter.main()
- self.assertEquals(
+ self.assertEqual(
reporter.output.getvalue().splitlines(), [
'= PPA user emails =',
'cprov | Celso Providelo | celso.providelo@xxxxxxxxxxxxx',
=== modified file 'lib/lp/soyuz/tests/test_binarypackagerelease.py'
--- lib/lp/soyuz/tests/test_binarypackagerelease.py 2012-01-01 02:58:52 +0000
+++ lib/lp/soyuz/tests/test_binarypackagerelease.py 2018-01-02 16:24:23 +0000
@@ -44,22 +44,22 @@
user_defined_fields=[
("Python-Version", ">= 2.4"),
("Other", "Bla")])
- self.assertEquals([
+ self.assertEqual([
["Python-Version", ">= 2.4"],
["Other", "Bla"]], release.user_defined_fields)
def test_homepage_default(self):
# By default, no homepage is set.
bpr = self.factory.makeBinaryPackageRelease()
- self.assertEquals(None, bpr.homepage)
+ self.assertIsNone(bpr.homepage)
def test_homepage_empty(self):
# The homepage field can be empty.
bpr = self.factory.makeBinaryPackageRelease(homepage="")
- self.assertEquals("", bpr.homepage)
+ self.assertEqual("", bpr.homepage)
def test_homepage_set_invalid(self):
# As the homepage field is inherited from the .deb, the URL
# does not have to be valid.
bpr = self.factory.makeBinaryPackageRelease(homepage="<invalid<url")
- self.assertEquals("<invalid<url", bpr.homepage)
+ self.assertEqual("<invalid<url", bpr.homepage)
=== modified file 'lib/lp/soyuz/tests/test_build.py'
--- lib/lp/soyuz/tests/test_build.py 2016-02-05 16:51:12 +0000
+++ lib/lp/soyuz/tests/test_build.py 2018-01-02 16:24:23 +0000
@@ -70,7 +70,7 @@
self.das.architecturetag, spph.source_package_name,
spph.source_package_version, self.distroseries.distribution.name,
self.distroseries.name)
- self.assertEquals(expected_title, build.title)
+ self.assertEqual(expected_title, build.title)
def test_linking(self):
# A build directly links to the archive, distribution, distroseries,
@@ -81,14 +81,14 @@
version="%s.1" % self.factory.getUniqueInteger(),
distroseries=self.distroseries)
[build] = spph.createMissingBuilds()
- self.assertEquals(self.distroseries.main_archive, build.archive)
- self.assertEquals(self.distroseries.distribution, build.distribution)
- self.assertEquals(self.distroseries, build.distro_series)
- self.assertEquals(self.das, build.distro_arch_series)
- self.assertEquals(PackagePublishingPocket.RELEASE, build.pocket)
- self.assertEquals(self.das.architecturetag, build.arch_tag)
+ self.assertEqual(self.distroseries.main_archive, build.archive)
+ self.assertEqual(self.distroseries.distribution, build.distribution)
+ self.assertEqual(self.distroseries, build.distro_series)
+ self.assertEqual(self.das, build.distro_arch_series)
+ self.assertEqual(PackagePublishingPocket.RELEASE, build.pocket)
+ self.assertEqual(self.das.architecturetag, build.arch_tag)
self.assertTrue(build.virtualized)
- self.assertEquals(
+ self.assertEqual(
'%s - %s' % (spph.source_package_name,
spph.source_package_version),
build.source_package_release.title)
@@ -109,30 +109,30 @@
version=version, builder=self.builder)
build = binary[0].binarypackagerelease.build
self.assertTrue(build.was_built)
- self.assertEquals(
+ self.assertEqual(
PackageUploadStatus.DONE, build.package_upload.status)
- self.assertEquals(
+ self.assertEqual(
datetime(2008, 1, 1, 0, 0, 0, tzinfo=pytz.UTC),
build.date_started)
- self.assertEquals(
+ self.assertEqual(
datetime(2008, 1, 1, 0, 5, 0, tzinfo=pytz.UTC),
build.date_finished)
- self.assertEquals(timedelta(minutes=5), build.duration)
+ self.assertEqual(timedelta(minutes=5), build.duration)
expected_buildlog = 'buildlog_%s-%s-%s.%s_%s_FULLYBUILT.txt.gz' % (
self.distroseries.distribution.name, self.distroseries.name,
self.das.architecturetag, spn, version)
- self.assertEquals(expected_buildlog, build.log.filename)
+ self.assertEqual(expected_buildlog, build.log.filename)
url_start = (
'http://launchpad.dev/%s/+source/%s/%s/+build/%s/+files' % (
self.distroseries.distribution.name, spn, version, build.id))
expected_buildlog_url = '%s/%s' % (url_start, expected_buildlog)
- self.assertEquals(expected_buildlog_url, build.log_url)
+ self.assertEqual(expected_buildlog_url, build.log_url)
expected_changesfile = '%s_%s_%s.changes' % (
spn, version, self.das.architecturetag)
- self.assertEquals(
+ self.assertEqual(
expected_changesfile, build.upload_changesfile.filename)
expected_changesfile_url = '%s/%s' % (url_start, expected_changesfile)
- self.assertEquals(expected_changesfile_url, build.changesfile_url)
+ self.assertEqual(expected_changesfile_url, build.changesfile_url)
# Since this build was sucessful, it can not be retried
self.assertFalse(build.can_be_retried)
@@ -145,11 +145,11 @@
version="%s.1" % self.factory.getUniqueInteger(),
distroseries=self.distroseries)
[build] = spph.createMissingBuilds()
- self.assertEquals('main', build.current_component.name)
+ self.assertEqual('main', build.current_component.name)
# It may not be the same as
- self.assertEquals('main', build.source_package_release.component.name)
+ self.assertEqual('main', build.source_package_release.component.name)
# If the package has no uploads, its package_upload is None
- self.assertEquals(None, build.package_upload)
+ self.assertIsNone(build.package_upload)
def test_current_component_when_unpublished(self):
# Production has some buggy builds without source publications.
@@ -235,17 +235,17 @@
version="%s.1" % self.factory.getUniqueInteger(),
distroseries=self.distroseries)
[build] = spph.createMissingBuilds()
- self.assertEquals(None, build.upload_log)
- self.assertEquals(None, build.upload_log_url)
+ self.assertIsNone(build.upload_log)
+ self.assertIsNone(build.upload_log_url)
build.storeUploadLog('sample upload log')
expected_filename = 'upload_%s_log.txt' % build.id
- self.assertEquals(expected_filename, build.upload_log.filename)
+ self.assertEqual(expected_filename, build.upload_log.filename)
url_start = (
'http://launchpad.dev/%s/+source/%s/%s/+build/%s/+files' % (
self.distroseries.distribution.name, spph.source_package_name,
spph.source_package_version, build.id))
expected_url = '%s/%s' % (url_start, expected_filename)
- self.assertEquals(expected_url, build.upload_log_url)
+ self.assertEqual(expected_url, build.upload_log_url)
def test_retry_resets_state(self):
# Retrying a build resets most of the state attributes, but does
@@ -256,11 +256,11 @@
build.gotFailure()
with person_logged_in(self.admin):
build.retry()
- self.assertEquals(BuildStatus.NEEDSBUILD, build.status)
- self.assertEquals(self.now, build.date_first_dispatched)
- self.assertEquals(None, build.log)
- self.assertEquals(None, build.upload_log)
- self.assertEquals(0, build.failure_count)
+ self.assertEqual(BuildStatus.NEEDSBUILD, build.status)
+ self.assertEqual(self.now, build.date_first_dispatched)
+ self.assertIsNone(build.log)
+ self.assertIsNone(build.upload_log)
+ self.assertEqual(0, build.failure_count)
def test_retry_resets_virtualized(self):
# Retrying a build recalculates its virtualization.
@@ -294,8 +294,8 @@
section=spph.sourcepackagerelease.section.id,
priority=PackagePublishingPriority.STANDARD, installedsize=0,
architecturespecific=False)
- self.assertEquals(1, build.binarypackages.count())
- self.assertEquals([binary], list(build.binarypackages))
+ self.assertEqual(1, build.binarypackages.count())
+ self.assertEqual([binary], list(build.binarypackages))
def test_multiple_create_bpr(self):
# We can create multiple BPRs from a build
@@ -316,11 +316,11 @@
section=spph.sourcepackagerelease.section.id,
priority=PackagePublishingPriority.STANDARD, installedsize=0,
architecturespecific=False)
- self.assertEquals(15, build.binarypackages.count())
+ self.assertEqual(15, build.binarypackages.count())
bin_names = [b.name for b in build.binarypackages]
# Verify .binarypackages returns sorted by name
expected_names.sort()
- self.assertEquals(expected_names, bin_names)
+ self.assertEqual(expected_names, bin_names)
def test_cannot_rescore_non_needsbuilds_builds(self):
# If a build record isn't in NEEDSBUILD, it can not be rescored.
@@ -340,12 +340,12 @@
version="%s.1" % self.factory.getUniqueInteger(),
distroseries=self.distroseries)
[build] = spph.createMissingBuilds()
- self.assertEquals(BuildStatus.NEEDSBUILD, build.status)
- self.assertEquals(2505, build.buildqueue_record.lastscore)
+ self.assertEqual(BuildStatus.NEEDSBUILD, build.status)
+ self.assertEqual(2505, build.buildqueue_record.lastscore)
with person_logged_in(self.admin):
build.rescore(5000)
transaction.commit()
- self.assertEquals(5000, build.buildqueue_record.lastscore)
+ self.assertEqual(5000, build.buildqueue_record.lastscore)
def test_source_publication_override(self):
# Components can be overridden in builds.
@@ -354,13 +354,13 @@
version="%s.1" % self.factory.getUniqueInteger(),
distroseries=self.distroseries)
[build] = spph.createMissingBuilds()
- self.assertEquals(spph, build.current_source_publication)
+ self.assertEqual(spph, build.current_source_publication)
universe = getUtility(IComponentSet)['universe']
overridden_spph = spph.changeOverride(new_component=universe)
# We can now see current source publication points to the overridden
# publication.
- self.assertNotEquals(spph, build.current_source_publication)
- self.assertEquals(overridden_spph, build.current_source_publication)
+ self.assertNotEqual(spph, build.current_source_publication)
+ self.assertEqual(overridden_spph, build.current_source_publication)
def test_estimated_duration(self):
# Builds will have an estimated duration that is set to a
@@ -370,7 +370,7 @@
sourcename=spn, status=PackagePublishingStatus.PUBLISHED)
[build] = spph.createMissingBuilds()
# Duration is based on package size if there is no previous build.
- self.assertEquals(
+ self.assertEqual(
timedelta(0, 60), build.buildqueue_record.estimated_duration)
# Set the build as done, and its duration.
build.updateStatus(
@@ -382,7 +382,7 @@
sourcename=spn, status=PackagePublishingStatus.PUBLISHED)
[new_build] = new_spph.createMissingBuilds()
# The duration for this build is now 72 minutes.
- self.assertEquals(
+ self.assertEqual(
timedelta(0, 72 * 60),
new_build.buildqueue_record.estimated_duration)
=== modified file 'lib/lp/soyuz/tests/test_build_depwait.py'
--- lib/lp/soyuz/tests/test_build_depwait.py 2015-04-20 15:59:52 +0000
+++ lib/lp/soyuz/tests/test_build_depwait.py 2018-01-02 16:24:23 +0000
@@ -67,7 +67,7 @@
# Commit to make sure stuff hits the database.
transaction.commit()
build.updateDependencies()
- self.assertEquals(u'', build.dependencies)
+ self.assertEqual(u'', build.dependencies)
def test_update_dependancies_respects_component(self):
# Since main can only utilise packages that are published in main,
@@ -92,10 +92,10 @@
transaction.commit()
build.updateDependencies()
# Since the dependency is in universe, we still can't see it.
- self.assertEquals(unicode(spn), build.dependencies)
+ self.assertEqual(unicode(spn), build.dependencies)
with person_logged_in(self.admin):
bpph.component = getUtility(IComponentSet)['main']
transaction.commit()
# Now that we have moved it main, we can see it.
build.updateDependencies()
- self.assertEquals(u'', build.dependencies)
+ self.assertEqual(u'', build.dependencies)
=== modified file 'lib/lp/soyuz/tests/test_build_privacy.py'
--- lib/lp/soyuz/tests/test_build_privacy.py 2015-04-20 15:59:52 +0000
+++ lib/lp/soyuz/tests/test_build_privacy.py 2018-01-02 16:24:23 +0000
@@ -59,7 +59,7 @@
with person_logged_in(self.admin):
private = getUtility(IArchiveSet).get(self.private_archive.id)
[build] = private.getBuildRecords()
- self.assertEquals(self.expected_title, build.title)
+ self.assertEqual(self.expected_title, build.title)
def test_owner_can_see_own_private_builds(self):
# The owner of the private archive is able to see all builds that
@@ -67,7 +67,7 @@
with person_logged_in(self.private_archive.owner):
private = getUtility(IArchiveSet).get(self.private_archive.id)
[build] = private.getBuildRecords()
- self.assertEquals(self.expected_title, build.title)
+ self.assertEqual(self.expected_title, build.title)
def test_buildd_admin_cannot_see_private_builds(self):
# Admins that look after the builders ("buildd-admins"), can not see
=== modified file 'lib/lp/soyuz/tests/test_build_set.py'
--- lib/lp/soyuz/tests/test_build_set.py 2015-09-28 17:38:45 +0000
+++ lib/lp/soyuz/tests/test_build_set.py 2018-01-02 16:24:23 +0000
@@ -124,28 +124,28 @@
self.setUpBuilds()
set = getUtility(IBinaryPackageBuildSet).getBuildsForDistro(
self.distribution)
- self.assertEquals(set.count(), 10)
+ self.assertEqual(set.count(), 10)
def test_get_for_distro_distroseries(self):
# Test fetching builds for a distroseries' main archives
self.setUpBuilds()
set = getUtility(IBinaryPackageBuildSet).getBuildsForDistro(
self.distroseries)
- self.assertEquals(set.count(), 10)
+ self.assertEqual(set.count(), 10)
def test_get_for_distro_distroarchseries(self):
# Test fetching builds for a distroarchseries' main archives
self.setUpBuilds()
set = getUtility(IBinaryPackageBuildSet).getBuildsForDistro(
self.das_one)
- self.assertEquals(set.count(), 5)
+ self.assertEqual(set.count(), 5)
def test_get_for_distro_filter_build_status(self):
# The result can be filtered based on the build status
self.setUpBuilds()
set = getUtility(IBinaryPackageBuildSet).getBuildsForDistro(
self.distribution, status=BuildStatus.FULLYBUILT)
- self.assertEquals(set.count(), 8)
+ self.assertEqual(set.count(), 8)
def test_get_for_distro_filter_name(self):
# The result can be filtered based on the name
@@ -153,24 +153,24 @@
spn = self.builds[2].source_package_release.sourcepackagename.name
set = getUtility(IBinaryPackageBuildSet).getBuildsForDistro(
self.distribution, name=spn)
- self.assertEquals(set.count(), 2)
+ self.assertEqual(set.count(), 2)
def test_get_for_distro_filter_pocket(self):
# The result can be filtered based on the pocket of the build
self.setUpBuilds()
set = getUtility(IBinaryPackageBuildSet).getBuildsForDistro(
self.distribution, pocket=PackagePublishingPocket.RELEASE)
- self.assertEquals(set.count(), 10)
+ self.assertEqual(set.count(), 10)
set = getUtility(IBinaryPackageBuildSet).getBuildsForDistro(
self.distribution, pocket=PackagePublishingPocket.UPDATES)
- self.assertEquals(set.count(), 0)
+ self.assertEqual(set.count(), 0)
def test_get_for_distro_filter_arch_tag(self):
# The result can be filtered based on the archtag of the build
self.setUpBuilds()
set = getUtility(IBinaryPackageBuildSet).getBuildsForDistro(
self.distribution, arch_tag=self.das_one.architecturetag)
- self.assertEquals(set.count(), 5)
+ self.assertEqual(set.count(), 5)
def test_get_status_summary_for_builds(self):
# We can query for the status summary of a number of builds
@@ -179,8 +179,8 @@
summary = getUtility(
IBinaryPackageBuildSet).getStatusSummaryForBuilds(
relevant_builds)
- self.assertEquals(summary['status'], BuildSetStatus.FAILEDTOBUILD)
- self.assertEquals(summary['builds'], [self.builds[-2]])
+ self.assertEqual(summary['status'], BuildSetStatus.FAILEDTOBUILD)
+ self.assertEqual(summary['builds'], [self.builds[-2]])
def test_preload_data(self):
# The BuildSet class allows data to be preloaded
@@ -190,7 +190,7 @@
build_ids = [self.builds[i] for i in (0, 1, 2, 3)]
rset = removeSecurityProxy(
getUtility(IBinaryPackageBuildSet))._prefetchBuildData(build_ids)
- self.assertEquals(len(rset), 4)
+ self.assertEqual(len(rset), 4)
def test_get_builds_by_source_package_release(self):
# We are able to return all of the builds for the source package
@@ -210,7 +210,7 @@
self.distroseries.distribution.name,
self.distroseries.name))
build_titles = [build.title for build in builds]
- self.assertEquals(sorted(expected_titles), sorted(build_titles))
+ self.assertEqual(sorted(expected_titles), sorted(build_titles))
def test_get_builds_by_source_package_release_filtering(self):
self.setUpBuilds()
@@ -227,21 +227,21 @@
self.distroseries.distribution.name,
self.distroseries.name))
build_titles = [build.title for build in builds]
- self.assertEquals(sorted(expected_titles), sorted(build_titles))
+ self.assertEqual(sorted(expected_titles), sorted(build_titles))
builds = getUtility(
IBinaryPackageBuildSet).getBuildsBySourcePackageRelease(
ids, buildstate=BuildStatus.CHROOTWAIT)
- self.assertEquals([], list(builds))
+ self.assertEqual([], list(builds))
def test_no_get_builds_by_source_package_release(self):
# If no ids or None are passed into .getBuildsBySourcePackageRelease,
# an empty list is returned.
builds = getUtility(
IBinaryPackageBuildSet).getBuildsBySourcePackageRelease(None)
- self.assertEquals([], builds)
+ self.assertEqual([], builds)
builds = getUtility(
IBinaryPackageBuildSet).getBuildsBySourcePackageRelease([])
- self.assertEquals([], builds)
+ self.assertEqual([], builds)
def test_getBySourceAndLocation(self):
self.setUpBuilds()
=== modified file 'lib/lp/soyuz/tests/test_build_start_estimation.py'
--- lib/lp/soyuz/tests/test_build_start_estimation.py 2015-10-21 09:37:08 +0000
+++ lib/lp/soyuz/tests/test_build_start_estimation.py 2018-01-02 16:24:23 +0000
@@ -76,12 +76,12 @@
now = datetime.now(pytz.UTC)
# Since build1 is higher priority, it's estimated dispatch time is now
estimate = self.job_start_estimate(build1)
- self.assertEquals(5, (estimate - now).seconds)
+ self.assertEqual(5, (estimate - now).seconds)
# And build2 is next, so must take build1's duration into account
estimate = self.job_start_estimate(build2)
- self.assertEquals(600, (estimate - now).seconds)
+ self.assertEqual(600, (estimate - now).seconds)
# If we disable build1's archive, build2 is next
with person_logged_in(self.admin):
build1.archive.disable()
estimate = self.job_start_estimate(build2)
- self.assertEquals(5, (estimate - now).seconds)
+ self.assertEqual(5, (estimate - now).seconds)
=== modified file 'lib/lp/soyuz/tests/test_distroseriesdifferencejob.py'
--- lib/lp/soyuz/tests/test_distroseriesdifferencejob.py 2014-07-08 06:34:37 +0000
+++ lib/lp/soyuz/tests/test_distroseriesdifferencejob.py 2018-01-02 16:24:23 +0000
@@ -289,7 +289,7 @@
jobs = find_waiting_jobs(
dsp.derived_series, package, dsp.parent_series)
- self.assertEquals(len(jobs), 1)
+ self.assertEqual(len(jobs), 1)
self.assertJobsSeriesAndMetadata(
jobs[0], dsp.derived_series, [package.id, dsp.parent_series.id])
@@ -306,7 +306,7 @@
parent_jobs = find_waiting_jobs(
parent_dsp.derived_series, package, parent_dsp.parent_series)
- self.assertEquals(len(parent_jobs), 1)
+ self.assertEqual(len(parent_jobs), 1)
self.assertJobsSeriesAndMetadata(
parent_jobs[0], dsp.parent_series,
[package.id, parent_dsp.parent_series.id])
=== modified file 'lib/lp/soyuz/tests/test_hasbuildrecords.py'
--- lib/lp/soyuz/tests/test_hasbuildrecords.py 2018-01-02 10:54:31 +0000
+++ lib/lp/soyuz/tests/test_hasbuildrecords.py 2018-01-02 16:24:23 +0000
@@ -120,7 +120,7 @@
def test_get_build_records(self):
# A Distribution also implements IHasBuildRecords.
builds = self.distribution.getBuildRecords().count()
- self.assertEquals(10, builds)
+ self.assertEqual(10, builds)
class TestDistroSeriesHasBuildRecords(TestHasBuildRecordsInterface):
@@ -142,19 +142,19 @@
def test_distroarchseries(self):
# We can fetch builds records from a DistroArchSeries.
builds = self.das_one.getBuildRecords().count()
- self.assertEquals(5, builds)
+ self.assertEqual(5, builds)
builds = self.das_one.getBuildRecords(
build_state=BuildStatus.FULLYBUILT).count()
- self.assertEquals(4, builds)
+ self.assertEqual(4, builds)
spn = self.builds[0].source_package_release.sourcepackagename.name
builds = self.das_one.getBuildRecords(name=spn).count()
- self.assertEquals(1, builds)
+ self.assertEqual(1, builds)
builds = self.das_one.getBuildRecords(
pocket=PackagePublishingPocket.RELEASE).count()
- self.assertEquals(5, builds)
+ self.assertEqual(5, builds)
builds = self.das_one.getBuildRecords(
pocket=PackagePublishingPocket.UPDATES).count()
- self.assertEquals(0, builds)
+ self.assertEqual(0, builds)
class TestArchiveHasBuildRecords(TestHasBuildRecordsInterface):
@@ -261,13 +261,13 @@
# We can fetch builds records from a SourcePackage.
builds = self.context.getBuildRecords(
build_state=BuildStatus.FULLYBUILT).count()
- self.assertEquals(3, builds)
+ self.assertEqual(3, builds)
builds = self.context.getBuildRecords(
pocket=PackagePublishingPocket.RELEASE).count()
- self.assertEquals(2, builds)
+ self.assertEqual(2, builds)
builds = self.context.getBuildRecords(
pocket=PackagePublishingPocket.UPDATES).count()
- self.assertEquals(0, builds)
+ self.assertEqual(0, builds)
def test_ordering_date(self):
# Build records returned are ordered by creation date.
@@ -291,7 +291,7 @@
build1.buildqueue_record.lastscore = 10
build2.buildqueue_record.lastscore = 1000
builds = list(source_package.getBuildRecords())
- self.assertEquals([build2, build1], builds)
+ self.assertEqual([build2, build1], builds)
def test_copy_archive_without_leak(self):
# If source publications are copied to a .COPY archive, they don't
@@ -322,8 +322,8 @@
distroseries, PackagePublishingPocket.RELEASE, copy)
[copy_build] = copy_spph.createMissingBuilds()
builds = copy.getBuildRecords()
- self.assertEquals([copy_build], list(builds))
+ self.assertEqual([copy_build], list(builds))
source = SourcePackage(spn, spph.distroseries)
# SourcePackage.getBuildRecords() doesn't have two build records.
builds = source.getBuildRecords().count()
- self.assertEquals(1, builds)
+ self.assertEqual(1, builds)
=== modified file 'lib/lp/soyuz/tests/test_packagetranslationsuploadjob.py'
--- lib/lp/soyuz/tests/test_packagetranslationsuploadjob.py 2014-04-24 06:45:51 +0000
+++ lib/lp/soyuz/tests/test_packagetranslationsuploadjob.py 2018-01-02 16:24:23 +0000
@@ -98,9 +98,9 @@
def test_getErrorRecipients_requester(self):
_, _, job = self.makeJob()
email = format_address_for_person(job.requester)
- self.assertEquals([email], job.getErrorRecipients())
+ self.assertEqual([email], job.getErrorRecipients())
removeSecurityProxy(job).requester = None
- self.assertEquals([], job.getErrorRecipients())
+ self.assertEqual([], job.getErrorRecipients())
def test_run(self):
_, _, job = self.makeJob()
=== modified file 'lib/lp/soyuz/tests/test_publishing_models.py'
--- lib/lp/soyuz/tests/test_publishing_models.py 2015-11-08 01:09:46 +0000
+++ lib/lp/soyuz/tests/test_publishing_models.py 2018-01-02 16:24:23 +0000
@@ -107,9 +107,9 @@
self.publishing_set.getChangesFileLFA(hist.sourcepackagerelease)
for hist in self.sources)
urls = [lfa.http_url for lfa in lfas]
- self.assert_(urls[0].endswith('/foo_666_source.changes'))
- self.assert_(urls[1].endswith('/bar_666_source.changes'))
- self.assert_(urls[2].endswith('/baz_666_source.changes'))
+ self.assertTrue(urls[0].endswith('/foo_666_source.changes'))
+ self.assertTrue(urls[1].endswith('/bar_666_source.changes'))
+ self.assertTrue(urls[2].endswith('/baz_666_source.changes'))
class TestSourcePackagePublishingHistory(TestCaseWithFactory):
@@ -121,7 +121,7 @@
ancestor = self.factory.makeSourcePackagePublishingHistory()
spph = self.factory.makeSourcePackagePublishingHistory(
ancestor=ancestor)
- self.assertEquals(spph.ancestor.displayname, ancestor.displayname)
+ self.assertEqual(spph.ancestor.displayname, ancestor.displayname)
def test_changelogUrl_missing(self):
spr = self.factory.makeSourcePackageRelease(changelog=None)
=== modified file 'lib/lp/soyuz/tests/test_sourcepackagerelease.py'
--- lib/lp/soyuz/tests/test_sourcepackagerelease.py 2015-06-05 21:24:50 +0000
+++ lib/lp/soyuz/tests/test_sourcepackagerelease.py 2018-01-02 16:24:23 +0000
@@ -50,25 +50,25 @@
user_defined_fields=[
("Python-Version", ">= 2.4"),
("Other", "Bla")])
- self.assertEquals([
+ self.assertEqual([
["Python-Version", ">= 2.4"],
["Other", "Bla"]], release.user_defined_fields)
def test_homepage_default(self):
# By default, no homepage is set.
spr = self.factory.makeSourcePackageRelease()
- self.assertEquals(None, spr.homepage)
+ self.assertIsNone(spr.homepage)
def test_homepage_empty(self):
# The homepage field can be empty.
spr = self.factory.makeSourcePackageRelease(homepage="")
- self.assertEquals("", spr.homepage)
+ self.assertEqual("", spr.homepage)
def test_homepage_set_invalid(self):
# As the homepage field is inherited from the DSCFile, the URL
# does not have to be valid.
spr = self.factory.makeSourcePackageRelease(homepage="<invalid<url")
- self.assertEquals("<invalid<url", spr.homepage)
+ self.assertEqual("<invalid<url", spr.homepage)
def test_aggregate_changelog(self):
# If since_version is passed the "changelog" entry returned
=== modified file 'lib/lp/testing/swift/tests/test_fixture.py'
--- lib/lp/testing/swift/tests/test_fixture.py 2017-12-07 12:05:13 +0000
+++ lib/lp/testing/swift/tests/test_fixture.py 2018-01-02 16:24:23 +0000
@@ -193,7 +193,7 @@
# Things work fine when the Swift server is up.
self.swift_fixture.startup()
headers, body = client.get_object("size", str(size))
- self.assertEquals(body, "0" * size)
+ self.assertEqual(body, "0" * size)
# But if the Swift server goes away again, we end up with
# different failures since the connection has already
@@ -213,7 +213,7 @@
# But fresh connections are fine.
client = self.swift_fixture.connect()
headers, body = client.get_object("size", str(size))
- self.assertEquals(body, "0" * size)
+ self.assertEqual(body, "0" * size)
def test_env(self):
self.assertEqual(
=== modified file 'lib/lp/testing/tests/test_factory.py'
--- lib/lp/testing/tests/test_factory.py 2016-02-05 16:51:12 +0000
+++ lib/lp/testing/tests/test_factory.py 2018-01-02 16:24:23 +0000
@@ -147,30 +147,30 @@
def test_makeBinaryPackagePublishingHistory_uses_status(self):
bpph = self.factory.makeBinaryPackagePublishingHistory(
status=PackagePublishingStatus.PENDING)
- self.assertEquals(PackagePublishingStatus.PENDING, bpph.status)
+ self.assertEqual(PackagePublishingStatus.PENDING, bpph.status)
bpph = self.factory.makeBinaryPackagePublishingHistory(
status=PackagePublishingStatus.PUBLISHED)
- self.assertEquals(PackagePublishingStatus.PUBLISHED, bpph.status)
+ self.assertEqual(PackagePublishingStatus.PUBLISHED, bpph.status)
def test_makeBinaryPackagePublishingHistory_uses_dateremoved(self):
dateremoved = datetime.now(pytz.UTC)
bpph = self.factory.makeBinaryPackagePublishingHistory(
dateremoved=dateremoved)
- self.assertEquals(dateremoved, bpph.dateremoved)
+ self.assertEqual(dateremoved, bpph.dateremoved)
def test_makeBinaryPackagePublishingHistory_scheduleddeletiondate(self):
scheduleddeletiondate = datetime.now(pytz.UTC)
bpph = self.factory.makeBinaryPackagePublishingHistory(
scheduleddeletiondate=scheduleddeletiondate)
- self.assertEquals(scheduleddeletiondate, bpph.scheduleddeletiondate)
+ self.assertEqual(scheduleddeletiondate, bpph.scheduleddeletiondate)
def test_makeBinaryPackagePublishingHistory_uses_priority(self):
bpph = self.factory.makeBinaryPackagePublishingHistory(
priority=PackagePublishingPriority.OPTIONAL)
- self.assertEquals(PackagePublishingPriority.OPTIONAL, bpph.priority)
+ self.assertEqual(PackagePublishingPriority.OPTIONAL, bpph.priority)
bpph = self.factory.makeBinaryPackagePublishingHistory(
priority=PackagePublishingPriority.EXTRA)
- self.assertEquals(PackagePublishingPriority.EXTRA, bpph.priority)
+ self.assertEqual(PackagePublishingPriority.EXTRA, bpph.priority)
def test_makeBinaryPackagePublishingHistory_sets_datecreated(self):
bpph = self.factory.makeBinaryPackagePublishingHistory()
@@ -429,15 +429,14 @@
self.assertTrue(ILanguage.providedBy(language))
self.assertTrue(language.code.startswith('lang'))
# And name is constructed from code as 'Language %(code)s'.
- self.assertEquals('Language %s' % language.code,
- language.englishname)
+ self.assertEqual('Language %s' % language.code, language.englishname)
def test_makeLanguage_with_code(self):
# With language code passed in, that's used for the language.
language = self.factory.makeLanguage('sr@test')
- self.assertEquals('sr@test', language.code)
+ self.assertEqual('sr@test', language.code)
# And name is constructed from code as 'Language %(code)s'.
- self.assertEquals('Language sr@test', language.englishname)
+ self.assertEqual('Language sr@test', language.englishname)
def test_makeLanguage_with_name(self):
# Language name can be passed in to makeLanguage (useful for
@@ -446,7 +445,7 @@
self.assertTrue(ILanguage.providedBy(language))
self.assertTrue(language.code.startswith('lang'))
# And name is constructed from code as 'Language %(code)s'.
- self.assertEquals('Test language', language.englishname)
+ self.assertEqual('Test language', language.englishname)
def test_makeLanguage_with_pluralforms(self):
# makeLanguage takes a number of plural forms for the language.
@@ -477,38 +476,38 @@
spr = self.factory.makeSourcePackageRelease()
spph = self.factory.makeSourcePackagePublishingHistory(
sourcepackagerelease=spr)
- self.assertEquals(spr, spph.sourcepackagerelease)
+ self.assertEqual(spr, spph.sourcepackagerelease)
def test_makeSourcePackagePublishingHistory_uses_status(self):
spph = self.factory.makeSourcePackagePublishingHistory(
status=PackagePublishingStatus.PENDING)
- self.assertEquals(PackagePublishingStatus.PENDING, spph.status)
+ self.assertEqual(PackagePublishingStatus.PENDING, spph.status)
spph = self.factory.makeSourcePackagePublishingHistory(
status=PackagePublishingStatus.PUBLISHED)
- self.assertEquals(PackagePublishingStatus.PUBLISHED, spph.status)
+ self.assertEqual(PackagePublishingStatus.PUBLISHED, spph.status)
def test_makeSourcePackagePublishingHistory_uses_date_uploaded(self):
date_uploaded = datetime.now(pytz.UTC)
spph = self.factory.makeSourcePackagePublishingHistory(
date_uploaded=date_uploaded)
- self.assertEquals(date_uploaded, spph.datecreated)
+ self.assertEqual(date_uploaded, spph.datecreated)
def test_makeSourcePackagePublishingHistory_uses_dateremoved(self):
dateremoved = datetime.now(pytz.UTC)
spph = self.factory.makeSourcePackagePublishingHistory(
dateremoved=dateremoved)
- self.assertEquals(dateremoved, spph.dateremoved)
+ self.assertEqual(dateremoved, spph.dateremoved)
def test_makeSourcePackagePublishingHistory_scheduleddeletiondate(self):
scheduleddeletiondate = datetime.now(pytz.UTC)
spph = self.factory.makeSourcePackagePublishingHistory(
scheduleddeletiondate=scheduleddeletiondate)
- self.assertEquals(scheduleddeletiondate, spph.scheduleddeletiondate)
+ self.assertEqual(scheduleddeletiondate, spph.scheduleddeletiondate)
def test_makeSourcePackagePublishingHistory_datepublished_PENDING(self):
spph = self.factory.makeSourcePackagePublishingHistory(
status=PackagePublishingStatus.PENDING)
- self.assertEquals(None, spph.datepublished)
+ self.assertIsNone(spph.datepublished)
def test_makeSourcePackagePublishingHistory_datepublished_PUBLISHED(self):
spph = self.factory.makeSourcePackagePublishingHistory(
=== modified file 'lib/lp/testing/tests/test_fixture.py'
--- lib/lp/testing/tests/test_fixture.py 2017-09-02 13:29:14 +0000
+++ lib/lp/testing/tests/test_fixture.py 2018-01-02 16:24:23 +0000
@@ -209,7 +209,7 @@
return False
def test_install_fixture(self):
- self.assert_(self.is_db_available())
+ self.assertTrue(self.is_db_available())
with PGBouncerFixture() as pgbouncer:
self.assertTrue(self.is_db_available())
@@ -222,7 +222,7 @@
self.assertTrue(self.is_db_available())
def test_install_fixture_with_restart(self):
- self.assert_(self.is_db_available())
+ self.assertTrue(self.is_db_available())
with PGBouncerFixture() as pgbouncer:
self.assertTrue(self.is_db_available())
=== modified file 'lib/lp/testing/tests/test_layers_functional.py'
--- lib/lp/testing/tests/test_layers_functional.py 2018-01-02 15:23:24 +0000
+++ lib/lp/testing/tests/test_layers_functional.py 2018-01-02 16:24:23 +0000
@@ -563,7 +563,7 @@
# XXX: Robert Collins 2010-10-17 bug=661967 - this isn't a reset, its
# a flag that it *needs* a reset, which is actually quite different;
# the lack of a teardown will leak databases.
- self.assertEquals(True, LaunchpadTestSetup()._reset_db)
+ self.assertEqual(True, LaunchpadTestSetup()._reset_db)
class TestNameTestCase(testtools.TestCase):
=== modified file 'lib/lp/testing/tests/test_matchers.py'
--- lib/lp/testing/tests/test_matchers.py 2017-11-04 23:21:54 +0000
+++ lib/lp/testing/tests/test_matchers.py 2018-01-02 16:24:23 +0000
@@ -138,7 +138,7 @@
obj, mismatch = self.match_does_not_verify()
try:
verifyObject(ITestInterface, obj)
- self.assert_("verifyObject did not raise an exception.")
+ self.assertTrue("verifyObject did not raise an exception.")
except BrokenImplementation as e:
extra = str(e)
self.assertEqual(extra, mismatch.extra)
=== modified file 'lib/lp/translations/browser/tests/test_baseexportview.py'
--- lib/lp/translations/browser/tests/test_baseexportview.py 2013-06-20 05:50:00 +0000
+++ lib/lp/translations/browser/tests/test_baseexportview.py 2018-01-02 16:24:23 +0000
@@ -61,12 +61,12 @@
def test_getDefaultFormat(self):
# With no templates in an object, default format is None.
- self.assertEquals(None, self.view.getDefaultFormat())
+ self.assertIsNone(self.view.getDefaultFormat())
# With one template added, it's format is returned.
template1 = self.createTranslationTemplate("one")
template1.source_file_format = TranslationFileFormat.XPI
- self.assertEquals(
+ self.assertEqual(
TranslationFileFormat.XPI,
self.view.getDefaultFormat())
@@ -74,13 +74,13 @@
# if they are different, where PO (1) < XPI (3).
template2 = self.createTranslationTemplate("two")
template2.source_file_format = TranslationFileFormat.PO
- self.assertEquals(
+ self.assertEqual(
TranslationFileFormat.PO,
self.view.getDefaultFormat())
# Obsolete templates do not affect default file format.
template2.iscurrent = False
- self.assertEquals(
+ self.assertEqual(
TranslationFileFormat.XPI,
self.view.getDefaultFormat())
@@ -88,33 +88,31 @@
# With no templates, empty ResultSet is returned for templates,
# and None for PO files.
templates, translations = self.view.processForm()
- self.assertEquals(([], None),
- (list(templates), None))
+ self.assertEqual(([], None), (list(templates), None))
# With just obsolete templates, empty results are returned again.
template1 = self.createTranslationTemplate("one")
template1.iscurrent = False
templates, translations = self.view.processForm()
- self.assertEquals(([], None),
- (list(templates), None))
+ self.assertEqual(([], None), (list(templates), None))
def test_processForm_templates(self):
# With a template, a ResultSet is returned for it.
template1 = self.createTranslationTemplate("one", priority=1)
templates, translations = self.view.processForm()
- self.assertEquals([template1.id], list(templates))
+ self.assertEqual([template1.id], list(templates))
# With more than one template, they are both returned
# ordered by decreasing priority.
template2 = self.createTranslationTemplate("two", priority=2)
templates, translations = self.view.processForm()
- self.assertEquals([template2.id, template1.id], list(templates))
+ self.assertEqual([template2.id, template1.id], list(templates))
def test_processForm_translations(self):
# With a template, but no PO files, None is returned for translations.
template1 = self.createTranslationTemplate("one")
templates, translations = self.view.processForm()
- self.assertEquals(translations, None)
+ self.assertIsNone(translations)
# Adding a PO file to this template makes it returned.
pofile_sr = self.factory.makePOFile('sr', potemplate=template1)
=== modified file 'lib/lp/translations/browser/tests/test_distroserieslanguage_views.py'
--- lib/lp/translations/browser/tests/test_distroserieslanguage_views.py 2012-08-09 03:50:49 +0000
+++ lib/lp/translations/browser/tests/test_distroserieslanguage_views.py 2018-01-02 16:24:23 +0000
@@ -40,9 +40,9 @@
self.dsl, LaunchpadTestRequest())
def test_empty_view(self):
- self.assertEquals(self.view.translation_group, None)
- self.assertEquals(self.view.translation_team, None)
- self.assertEquals(self.view.context, self.dsl)
+ self.assertIsNone(self.view.translation_group)
+ self.assertIsNone(self.view.translation_team)
+ self.assertEqual(self.view.context, self.dsl)
def test_translation_group(self):
group = self.factory.makeTranslationGroup(
@@ -51,7 +51,7 @@
self.view = DistroSeriesLanguageView(
self.dsl, LaunchpadTestRequest())
self.view.initialize()
- self.assertEquals(self.view.translation_group, group)
+ self.assertEqual(self.view.translation_group, group)
def test_translation_team(self):
# Just having a group doesn't mean there's a translation
@@ -59,7 +59,7 @@
group = self.factory.makeTranslationGroup(
self.distroseries.distribution.owner, url=None)
self.distroseries.distribution.translationgroup = group
- self.assertEquals(self.view.translation_team, None)
+ self.assertIsNone(self.view.translation_team)
# Setting a translator for this languages makes it
# appear as the translation_team.
@@ -70,7 +70,7 @@
self.view = DistroSeriesLanguageView(
self.dsl, LaunchpadTestRequest())
self.view.initialize()
- self.assertEquals(self.view.translation_team, translator)
+ self.assertEqual(self.view.translation_team, translator)
def test_sourcepackagenames_bulk_loaded(self):
# SourcePackageName records referenced by POTemplates
=== modified file 'lib/lp/translations/browser/tests/test_product_view.py'
--- lib/lp/translations/browser/tests/test_product_view.py 2015-06-26 09:59:30 +0000
+++ lib/lp/translations/browser/tests/test_product_view.py 2018-01-02 16:24:23 +0000
@@ -58,7 +58,7 @@
self.factory.makePOTemplate(
distroseries=sourcepackage.distroseries,
sourcepackagename=sourcepackage.sourcepackagename)
- self.assertEquals(None, view.primary_translatable)
+ self.assertIsNone(view.primary_translatable)
def test_untranslatable_series(self):
# Create a product that uses translations.
=== modified file 'lib/lp/translations/browser/tests/test_productserieslanguage_views.py'
--- lib/lp/translations/browser/tests/test_productserieslanguage_views.py 2012-09-18 19:41:02 +0000
+++ lib/lp/translations/browser/tests/test_productserieslanguage_views.py 2018-01-02 16:24:23 +0000
@@ -76,7 +76,7 @@
def test_productserieslanguages_no_template(self):
# With no POTemplates, no languages can be seen, either.
view = self._createView()
- self.assertEquals(None, view.productserieslanguages)
+ self.assertIsNone(view.productserieslanguages)
def _getProductserieslanguages(self, view):
return [psl.language for psl in view.productserieslanguages]
@@ -86,7 +86,7 @@
# of languages is empty.
self.factory.makePOTemplate(productseries=self.productseries)
view = self._createView()
- self.assertEquals([], self._getProductserieslanguages(view))
+ self.assertEqual([], self._getProductserieslanguages(view))
def test_productserieslanguages_with_pofile(self):
# The `productserieslanguages` properperty has a list of the
@@ -95,7 +95,7 @@
productseries=self.productseries)
pofile = self.factory.makePOFile(potemplate=potemplate)
view = self._createView()
- self.assertEquals(
+ self.assertEqual(
[pofile.language], self._getProductserieslanguages(view))
def _makePersonWithLanguage(self):
@@ -112,7 +112,7 @@
user, language = self._makePersonWithLanguage()
login_person(user)
view = self._createView()
- self.assertEquals([language], self._getProductserieslanguages(view))
+ self.assertEqual([language], self._getProductserieslanguages(view))
def test_productserieslanguages_preferred_language_with_pofile(self):
# If the user has a preferred language, that language always in
@@ -138,7 +138,7 @@
self.factory.makePOFile(language=language1, potemplate=potemplate)
self.factory.makePOFile(language=language2, potemplate=potemplate)
view = self._createView()
- self.assertEquals(
+ self.assertEqual(
[language2, language1], self._getProductserieslanguages(view))
def test_productserieslanguages_english(self):
@@ -148,12 +148,12 @@
productseries=self.productseries)
self.factory.makePOFile('en', potemplate)
view = self._createView()
- self.assertEquals([], self._getProductserieslanguages(view))
+ self.assertEqual([], self._getProductserieslanguages(view))
# It's not shown even with more than one POTemplate
# (different code paths).
self.factory.makePOTemplate(productseries=self.productseries)
- self.assertEquals([], self._getProductserieslanguages(view))
+ self.assertEqual([], self._getProductserieslanguages(view))
class TestProductSeriesViewBzrUsage(TestCaseWithFactory):
@@ -268,11 +268,11 @@
def test_translation_group_no_group(self):
view = self._createView()
- self.assertEquals(None, view.translation_group)
+ self.assertIsNone(view.translation_group)
def test_translation_team_no_group_no_team(self):
view = self._createView()
- self.assertEquals(None, view.translation_team)
+ self.assertIsNone(view.translation_team)
def _makeTranslationGroup(self):
group = self.factory.makeTranslationGroup(
@@ -283,14 +283,14 @@
def test_translation_group(self):
group = self._makeTranslationGroup()
view = self._createView()
- self.assertEquals(group, view.translation_group)
+ self.assertEqual(group, view.translation_group)
def test_translation_team_no_translator(self):
# Just having a group doesn't mean there's a translation
# team as well.
self._makeTranslationGroup()
view = self._createView()
- self.assertEquals(None, view.translation_team)
+ self.assertIsNone(view.translation_team)
def test_translation_team(self):
# Setting a translator for this languages makes it
@@ -299,4 +299,4 @@
translator = self.factory.makeTranslator(
group=group, language=self.language)
view = self._createView()
- self.assertEquals(translator, view.translation_team)
+ self.assertEqual(translator, view.translation_team)
=== modified file 'lib/lp/translations/scripts/tests/test_migrate_current_flag.py'
--- lib/lp/translations/scripts/tests/test_migrate_current_flag.py 2012-01-20 16:11:11 +0000
+++ lib/lp/translations/scripts/tests/test_migrate_current_flag.py 2018-01-02 16:24:23 +0000
@@ -30,7 +30,7 @@
# Sample data already has 3 products with templates.
sampledata_products = list(
self.migrate_process.getProductsWithTemplates())
- self.assertEquals(3, len(sampledata_products))
+ self.assertEqual(3, len(sampledata_products))
def test_getProductsWithTemplates_noop(self):
# Adding a product with no templates doesn't change anything.
@@ -178,11 +178,11 @@
diverged_imported = self.factory.makeCurrentTranslationMessage(
pofile=pofile, diverged=True, potmsgset=translation.potmsgset)
diverged_imported.is_current_ubuntu = True
- self.assertEquals(pofile.potemplate, diverged_imported.potemplate)
+ self.assertEqual(pofile.potemplate, diverged_imported.potemplate)
self.assertTrue(diverged_imported.is_current_upstream)
self.assertTrue(diverged_imported.is_current_ubuntu)
self.migrate_loop._updateTranslationMessages([translation.id])
- self.assertEquals(pofile.potemplate, diverged_imported.potemplate)
+ self.assertEqual(pofile.potemplate, diverged_imported.potemplate)
self.assertTrue(diverged_imported.is_current_upstream)
self.assertTrue(diverged_imported.is_current_ubuntu)
=== modified file 'lib/lp/translations/scripts/tests/test_translations_to_branch.py'
--- lib/lp/translations/scripts/tests/test_translations_to_branch.py 2013-06-20 05:50:00 +0000
+++ lib/lp/translations/scripts/tests/test_translations_to_branch.py 2018-01-02 16:24:23 +0000
@@ -319,7 +319,7 @@
pofile = self.factory.makePOFile()
exporter = ExportTranslationsToBranch(test_args=[])
- self.assertEquals(
+ self.assertEqual(
[pofile],
list(exporter._findChangedPOFiles(
pofile.potemplate.productseries,
@@ -330,7 +330,7 @@
# returned.
pofile = self.factory.makePOFile()
exporter = ExportTranslationsToBranch(test_args=[])
- self.assertEquals(
+ self.assertEqual(
[pofile],
list(exporter._findChangedPOFiles(
pofile.potemplate.productseries, changed_since=None)))
@@ -343,7 +343,7 @@
datetime.datetime.now(pytz.UTC) + datetime.timedelta(1))
exporter = ExportTranslationsToBranch(test_args=[])
- self.assertEquals(
+ self.assertEqual(
[],
list(exporter._findChangedPOFiles(
pofile.potemplate.productseries,
@@ -361,7 +361,7 @@
pofile.potemplate.date_last_updated = date_in_the_far_future
exporter = ExportTranslationsToBranch(test_args=[])
- self.assertEquals(
+ self.assertEqual(
[pofile],
list(exporter._findChangedPOFiles(
pofile.potemplate.productseries,
=== modified file 'lib/lp/translations/tests/test_hastranslationtemplates.py'
--- lib/lp/translations/tests/test_hastranslationtemplates.py 2012-01-01 02:58:52 +0000
+++ lib/lp/translations/tests/test_hastranslationtemplates.py 2018-01-02 16:24:23 +0000
@@ -53,28 +53,28 @@
# With no current templates, we get an empty result set.
results = self.container.getCurrentTranslationTemplates()
current_templates = list(results)
- self.assertEquals([], current_templates)
+ self.assertEqual([], current_templates)
self.assertFalse(bool(results.any()))
# With one of the templates marked as current, it is returned.
template1 = self.createTranslationTemplate("one", priority=1)
current_templates = list(
self.container.getCurrentTranslationTemplates())
- self.assertEquals([template1], current_templates)
+ self.assertEqual([template1], current_templates)
# With two current templates, they are sorted by priority,
# with higher numbers representing higher priority.
template2 = self.createTranslationTemplate("two", priority=2)
current_templates = list(
self.container.getCurrentTranslationTemplates())
- self.assertEquals([template2, template1], current_templates)
+ self.assertEqual([template2, template1], current_templates)
# Adding an obsolete template changes nothing.
template3 = self.createTranslationTemplate("obsolete")
template3.iscurrent = False
current_templates = list(
self.container.getCurrentTranslationTemplates())
- self.assertEquals([template2, template1], current_templates)
+ self.assertEqual([template2, template1], current_templates)
def test_getCurrentTranslationTemplates_ids(self):
# Returning just IDs works fine as well.
@@ -82,7 +82,7 @@
template2 = self.createTranslationTemplate("two", priority=2)
current_templates_ids = list(
self.container.getCurrentTranslationTemplates(just_ids=True))
- self.assertEquals(
+ self.assertEqual(
[template2.id, template1.id],
current_templates_ids)
@@ -90,14 +90,14 @@
# With no current templates, we get an empty result set.
current_translations = list(
self.container.getCurrentTranslationFiles())
- self.assertEquals([], current_translations)
+ self.assertEqual([], current_translations)
# Even with one of the templates marked as current, nothing is
# returned before POFile is added.
template1 = self.createTranslationTemplate("one")
current_translations = list(
self.container.getCurrentTranslationFiles())
- self.assertEquals([], current_translations)
+ self.assertEqual([], current_translations)
# If template is not current, nothing is returned even if
# there are POFiles attached to it.
@@ -105,7 +105,7 @@
self.factory.makePOFile('sr', potemplate=template1)
current_translations = list(
self.container.getCurrentTranslationFiles())
- self.assertEquals([], current_translations)
+ self.assertEqual([], current_translations)
def test_getCurrentTranslationFiles_current(self):
# If POFiles are attached to a current template, they are returned.
@@ -116,7 +116,7 @@
# to make tests stable.
current_translations = set(
self.container.getCurrentTranslationFiles())
- self.assertEquals(
+ self.assertEqual(
set([pofile_sr, pofile_es]),
current_translations)
@@ -125,7 +125,7 @@
pofile2_sr = self.factory.makePOFile('sr', potemplate=template2)
current_translations = set(
self.container.getCurrentTranslationFiles())
- self.assertEquals(
+ self.assertEqual(
set([pofile_sr, pofile_es, pofile2_sr]),
current_translations)
@@ -134,7 +134,7 @@
template2.iscurrent = False
current_translations = set(
self.container.getCurrentTranslationFiles())
- self.assertEquals(
+ self.assertEqual(
set([pofile_sr, pofile_es]),
current_translations)
@@ -145,7 +145,7 @@
pofile_es = self.factory.makePOFile('es', potemplate=template1)
current_translations_ids = set(
self.container.getCurrentTranslationFiles(just_ids=True))
- self.assertEquals(
+ self.assertEqual(
set([pofile_sr.id, pofile_es.id]),
current_translations_ids)
@@ -240,13 +240,13 @@
# With no templates, empty list is returned.
all_formats = self.container.getTranslationTemplateFormats()
- self.assertEquals([], all_formats)
+ self.assertEqual([], all_formats)
# With one template, that template's format is returned.
template1 = self.createTranslationTemplate("one")
template1.source_file_format = TranslationFileFormat.PO
all_formats = self.container.getTranslationTemplateFormats()
- self.assertEquals(
+ self.assertEqual(
[TranslationFileFormat.PO],
all_formats)
@@ -255,7 +255,7 @@
template2 = self.createTranslationTemplate("two")
template2.source_file_format = TranslationFileFormat.PO
all_formats = self.container.getTranslationTemplateFormats()
- self.assertEquals(
+ self.assertEqual(
[TranslationFileFormat.PO],
all_formats)
@@ -266,7 +266,7 @@
all_formats = self.container.getTranslationTemplateFormats()
# Items are sorted by the format values, PO==1 < XPI==3.
- self.assertEquals(
+ self.assertEqual(
[TranslationFileFormat.PO, TranslationFileFormat.XPI],
all_formats)
=== modified file 'lib/lp/translations/tests/test_helpers.py'
--- lib/lp/translations/tests/test_helpers.py 2012-01-01 02:58:52 +0000
+++ lib/lp/translations/tests/test_helpers.py 2018-01-02 16:24:23 +0000
@@ -39,7 +39,7 @@
tm = make_translationmessage(self.factory, pofile=self.pofile,
potmsgset=self.potmsgset,
translations=translations)
- self.assertEquals(translations, tm.translations)
+ self.assertEqual(translations, tm.translations)
def test_summarize_current_translations_baseline(self):
# The trivial case for summarize_current_translations: no
@@ -49,7 +49,7 @@
self.assertIs(None, current_shared)
self.assertIs(None, current_diverged)
self.assertIs(None, other)
- self.assertEquals([], divergences)
+ self.assertEqual([], divergences)
def test_summarize_current_translations_current_shared(self):
# summarize_current_translations when there is a single, shared
@@ -59,10 +59,10 @@
ubuntu=True, upstream=False, diverged=False)
current_shared, current_diverged, other, divergences = (
summarize_current_translations(self.pofile, self.potmsgset))
- self.assertEquals(tm, current_shared)
+ self.assertEqual(tm, current_shared)
self.assertIs(None, current_diverged)
self.assertIs(None, other)
- self.assertEquals([], divergences)
+ self.assertEqual([], divergences)
def test_summarize_current_translations_current_both(self):
# summarize_current_translations when there is a single message
@@ -72,10 +72,10 @@
ubuntu=True, upstream=True, diverged=False)
current_shared, current_diverged, other, divergences = (
summarize_current_translations(self.pofile, self.potmsgset))
- self.assertEquals(tm, current_shared)
+ self.assertEqual(tm, current_shared)
self.assertIs(None, current_diverged)
- self.assertEquals(tm, other)
- self.assertEquals([], divergences)
+ self.assertEqual(tm, other)
+ self.assertEqual([], divergences)
def test_summarize_current_translations_current_both_same(self):
# summarize_current_translations when there are identical but
@@ -92,14 +92,14 @@
self.assertIn(current_shared, (tm_ubuntu, tm_upstream))
if self.pofile.potemplate.distroseries is not None:
- self.assertEquals(tm_ubuntu, current_shared)
+ self.assertEqual(tm_ubuntu, current_shared)
else:
- self.assertEquals(tm_upstream, current_shared)
+ self.assertEqual(tm_upstream, current_shared)
self.assertIs(None, current_diverged)
self.assertIn(other, (tm_ubuntu, tm_upstream))
self.assertNotEqual(current_shared, other)
- self.assertEquals([], divergences)
+ self.assertEqual([], divergences)
def test_summarize_current_translations_current_2_different(self):
# summarize_current_translations when there are different
@@ -112,10 +112,10 @@
ubuntu=False, upstream=True, diverged=False)
current_shared, current_diverged, other, divergences = (
summarize_current_translations(self.pofile, self.potmsgset))
- self.assertEquals(tm_this, current_shared)
+ self.assertEqual(tm_this, current_shared)
self.assertIs(None, current_diverged)
- self.assertEquals(tm_other, other)
- self.assertEquals([], divergences)
+ self.assertEqual(tm_other, other)
+ self.assertEqual([], divergences)
def test_summarize_current_translations_current_3_different(self):
# summarize_current_translations when there are different
@@ -132,10 +132,10 @@
ubuntu=True, upstream=False, diverged=True)
current_shared, current_diverged, other, divergences = (
summarize_current_translations(self.pofile, self.potmsgset))
- self.assertEquals(tm_this, current_shared)
- self.assertEquals(tm_diverged, current_diverged)
- self.assertEquals(tm_other, other)
- self.assertEquals([], divergences)
+ self.assertEqual(tm_this, current_shared)
+ self.assertEqual(tm_diverged, current_diverged)
+ self.assertEqual(tm_other, other)
+ self.assertEqual([], divergences)
def test_summarize_current_translations_current_3_diverged_elsewh(self):
# summarize_current_translations when there are different
@@ -146,15 +146,15 @@
self.factory, pofile=self.other_pofile, potmsgset=self.potmsgset,
ubuntu=True, upstream=False, diverged=True)
self.assertTrue(tm_diverged.is_current_ubuntu)
- self.assertEquals(
+ self.assertEqual(
tm_diverged.potemplate, self.other_pofile.potemplate)
- self.assertEquals(self.potmsgset, tm_diverged.potmsgset)
+ self.assertEqual(self.potmsgset, tm_diverged.potmsgset)
current_shared, current_diverged, other, divergences = (
summarize_current_translations(self.pofile, self.potmsgset))
self.assertIs(None, current_shared)
self.assertIs(None, current_diverged)
self.assertIs(None, other)
- self.assertEquals([tm_diverged], divergences)
+ self.assertEqual([tm_diverged], divergences)
def test_summarize_current_translations_multiple_divergences_elsewh(self):
# summarize_current_translations when there are diverged
=== modified file 'lib/lp/translations/tests/test_pofile.py'
--- lib/lp/translations/tests/test_pofile.py 2018-01-02 10:54:31 +0000
+++ lib/lp/translations/tests/test_pofile.py 2018-01-02 16:24:23 +0000
@@ -101,18 +101,18 @@
# When there are no suggestions, nothing is returned.
found_translations = list(
self.devel_pofile.getPOTMsgSetWithNewSuggestions())
- self.assertEquals(found_translations, [])
+ self.assertEqual(found_translations, [])
# When a suggestion is added one day after, the potmsgset is returned.
suggestion_date = date_created + timedelta(1)
suggestion = self.factory.makeSuggestion(
pofile=self.devel_pofile, potmsgset=self.potmsgset,
translations=[u"Suggestion"], date_created=suggestion_date)
- self.assertEquals(suggestion.is_current_ubuntu, False)
+ self.assertEqual(suggestion.is_current_ubuntu, False)
found_translations = list(
self.devel_pofile.getPOTMsgSetWithNewSuggestions())
- self.assertEquals(found_translations, [self.potmsgset])
+ self.assertEqual(found_translations, [self.potmsgset])
# Setting a suggestion as current makes it have no unreviewed
# suggestions.
@@ -125,7 +125,7 @@
suggestion.is_current_ubuntu = True
found_translations = list(
self.devel_pofile.getPOTMsgSetWithNewSuggestions())
- self.assertEquals(found_translations, [])
+ self.assertEqual(found_translations, [])
# And adding another suggestion 2 days later, the potmsgset is
# again returned.
@@ -133,11 +133,11 @@
translation = self.factory.makeSuggestion(
pofile=self.devel_pofile, potmsgset=self.potmsgset,
translations=[u"New suggestion"], date_created=suggestion_date)
- self.assertEquals(translation.is_current_ubuntu, False)
+ self.assertEqual(translation.is_current_ubuntu, False)
found_translations = list(
self.devel_pofile.getPOTMsgSetWithNewSuggestions())
- self.assertEquals(found_translations, [self.potmsgset])
+ self.assertEqual(found_translations, [self.potmsgset])
def test_getPOTMsgSetWithNewSuggestions_diverged(self):
# Test listing of suggestions for POTMsgSets with a shared
@@ -173,12 +173,12 @@
suggestion = self.factory.makeSuggestion(
pofile=self.devel_pofile, potmsgset=self.potmsgset,
translations=[u"Shared suggestion"], date_created=suggestion_date)
- self.assertEquals(suggestion.is_current_ubuntu, False)
+ self.assertEqual(suggestion.is_current_ubuntu, False)
# A suggestion is shown since diverged_date < suggestion_date.
found_translations = list(
self.devel_pofile.getPOTMsgSetWithNewSuggestions())
- self.assertEquals(found_translations, [self.potmsgset])
+ self.assertEqual(found_translations, [self.potmsgset])
# When a diverged translation is added after the shared suggestion,
# there are no unreviewed suggestions.
@@ -192,18 +192,18 @@
diverged_translation_2.is_current_ubuntu = True
found_translations = list(
self.devel_pofile.getPOTMsgSetWithNewSuggestions())
- self.assertEquals(found_translations, [])
+ self.assertEqual(found_translations, [])
# When a suggestion is added one day after, the potmsgset is returned.
suggestion_date = diverged_date + timedelta(1)
suggestion = self.factory.makeSuggestion(
pofile=self.devel_pofile, potmsgset=self.potmsgset,
translations=[u"Suggestion"], date_created=suggestion_date)
- self.assertEquals(suggestion.is_current_ubuntu, False)
+ self.assertEqual(suggestion.is_current_ubuntu, False)
found_translations = list(
self.devel_pofile.getPOTMsgSetWithNewSuggestions())
- self.assertEquals(found_translations, [self.potmsgset])
+ self.assertEqual(found_translations, [self.potmsgset])
# Setting a suggestion as current makes it have no unreviewed
# suggestions.
@@ -211,7 +211,7 @@
suggestion.is_current_ubuntu = True
found_translations = list(
self.devel_pofile.getPOTMsgSetWithNewSuggestions())
- self.assertEquals(found_translations, [])
+ self.assertEqual(found_translations, [])
class TestTranslationSharedPOFile(TestCaseWithFactory):
@@ -268,14 +268,14 @@
found_potmsgsets = list(
self.devel_pofile.findPOTMsgSetsContaining(u"wild"))
- self.assertEquals(found_potmsgsets, [potmsgset])
+ self.assertEqual(found_potmsgsets, [potmsgset])
# Just linking an existing POTMsgSet into another POTemplate
# will make it be returned in searches.
potmsgset.setSequence(self.stable_potemplate, 2)
found_potmsgsets = list(
self.stable_pofile.findPOTMsgSetsContaining(u"wild"))
- self.assertEquals(found_potmsgsets, [potmsgset])
+ self.assertEqual(found_potmsgsets, [potmsgset])
# Searching for singular in plural messages works as well.
plural_potmsgset = self.factory.makePOTMsgSet(self.devel_potemplate,
@@ -285,13 +285,13 @@
found_potmsgsets = list(
self.devel_pofile.findPOTMsgSetsContaining(u"singular"))
- self.assertEquals(found_potmsgsets, [plural_potmsgset])
+ self.assertEqual(found_potmsgsets, [plural_potmsgset])
# And searching for plural text returns only the matching plural
# message.
found_potmsgsets = list(
self.devel_pofile.findPOTMsgSetsContaining(u"plural"))
- self.assertEquals(found_potmsgsets, [plural_potmsgset])
+ self.assertEqual(found_potmsgsets, [plural_potmsgset])
# Search translations as well.
self.factory.makeCurrentTranslationMessage(
@@ -299,7 +299,7 @@
translations=[u"One translation message"])
found_potmsgsets = list(
self.devel_pofile.findPOTMsgSetsContaining(u"translation"))
- self.assertEquals(found_potmsgsets, [potmsgset])
+ self.assertEqual(found_potmsgsets, [potmsgset])
# Search matches all plural forms.
self.factory.makeCurrentTranslationMessage(
@@ -310,24 +310,24 @@
found_potmsgsets = list(
self.devel_pofile.findPOTMsgSetsContaining(
u"Plural translation"))
- self.assertEquals(found_potmsgsets, [plural_potmsgset])
+ self.assertEqual(found_potmsgsets, [plural_potmsgset])
# Search works case insensitively for English strings.
found_potmsgsets = list(
self.devel_pofile.findPOTMsgSetsContaining(u"WiLd"))
- self.assertEquals(found_potmsgsets, [potmsgset])
+ self.assertEqual(found_potmsgsets, [potmsgset])
# ...English plural forms.
found_potmsgsets = list(
self.devel_pofile.findPOTMsgSetsContaining(u"PLurAl"))
- self.assertEquals(found_potmsgsets, [plural_potmsgset])
+ self.assertEqual(found_potmsgsets, [plural_potmsgset])
# ...translations.
found_potmsgsets = list(
self.devel_pofile.findPOTMsgSetsContaining(u"tRANSlaTIon"))
- self.assertEquals(found_potmsgsets, [potmsgset, plural_potmsgset])
+ self.assertEqual(found_potmsgsets, [potmsgset, plural_potmsgset])
# ...and translated plurals.
found_potmsgsets = list(
self.devel_pofile.findPOTMsgSetsContaining(u"THIRD"))
- self.assertEquals(found_potmsgsets, [plural_potmsgset])
+ self.assertEqual(found_potmsgsets, [plural_potmsgset])
def test_getTranslationsFilteredBy_none(self):
# When a person has submitted no translations, empty result set
@@ -339,7 +339,7 @@
# When there are no translations, empty list is returned.
found_translations = list(
self.devel_pofile.getTranslationsFilteredBy(submitter))
- self.assertEquals(found_translations, [])
+ self.assertEqual(found_translations, [])
def test_getTranslationsFilteredBy(self):
# If 'submitter' provides a translation for a pofile,
@@ -354,7 +354,7 @@
translator=submitter)
found_translations = list(
self.devel_pofile.getTranslationsFilteredBy(submitter))
- self.assertEquals(found_translations, [translation])
+ self.assertEqual(found_translations, [translation])
def test_getTranslationsFilteredBy_someone_else(self):
# If somebody else provides a translation, it's not added to the
@@ -370,7 +370,7 @@
translator=someone_else)
found_translations = list(
self.devel_pofile.getTranslationsFilteredBy(submitter))
- self.assertEquals(found_translations, [])
+ self.assertEqual(found_translations, [])
def test_getTranslationsFilteredBy_other_pofile(self):
# Adding a translation for the same POTMsgSet, but to a different
@@ -390,7 +390,7 @@
translator=submitter)
found_translations = list(
self.devel_pofile.getTranslationsFilteredBy(submitter))
- self.assertEquals(found_translations, [])
+ self.assertEqual(found_translations, [])
def test_getTranslationsFilteredBy_shared(self):
# If a POTMsgSet is shared between two templates, a
@@ -406,10 +406,10 @@
potmsgset.setSequence(self.stable_potemplate, 1)
stable_translations = list(
self.stable_pofile.getTranslationsFilteredBy(submitter))
- self.assertEquals(stable_translations, [translation])
+ self.assertEqual(stable_translations, [translation])
devel_translations = list(
self.devel_pofile.getTranslationsFilteredBy(submitter))
- self.assertEquals(devel_translations, [translation])
+ self.assertEqual(devel_translations, [translation])
def test_getPOTMsgSetTranslated_NoShared(self):
# Test listing of translated POTMsgSets when there is no shared
@@ -418,7 +418,7 @@
# When there is no diverged translation either, nothing is returned.
found_translations = list(
self.devel_pofile.getPOTMsgSetTranslated())
- self.assertEquals(found_translations, [])
+ self.assertEqual(found_translations, [])
# When a diverged translation is added, the potmsgset is returned.
self.factory.makeCurrentTranslationMessage(
@@ -426,7 +426,7 @@
translations=[u"Translation"], diverged=True)
found_translations = list(
self.devel_pofile.getPOTMsgSetTranslated())
- self.assertEquals(found_translations, [self.potmsgset])
+ self.assertEqual(found_translations, [self.potmsgset])
# If diverged translation is empty, POTMsgSet is not listed.
self.factory.makeCurrentTranslationMessage(
@@ -434,7 +434,7 @@
translations=[u""], diverged=True)
found_translations = list(
self.devel_pofile.getPOTMsgSetTranslated())
- self.assertEquals(found_translations, [])
+ self.assertEqual(found_translations, [])
def test_getPOTMsgSetTranslated_Shared(self):
# Test listing of translated POTMsgSets when there is a shared
@@ -448,7 +448,7 @@
# When there is no diverged translation, shared one is returned.
found_translations = list(
self.devel_pofile.getPOTMsgSetTranslated())
- self.assertEquals(found_translations, [self.potmsgset])
+ self.assertEqual(found_translations, [self.potmsgset])
# When an empty diverged translation is added, nothing is listed.
self.factory.makeCurrentTranslationMessage(
@@ -456,7 +456,7 @@
translations=[u""], diverged=True)
found_translations = list(
self.devel_pofile.getPOTMsgSetTranslated())
- self.assertEquals(found_translations, [])
+ self.assertEqual(found_translations, [])
# If diverged translation is non-empty, POTMsgSet is listed.
self.factory.makeCurrentTranslationMessage(
@@ -464,7 +464,7 @@
translations=[u"Translation"], diverged=True)
found_translations = list(
self.devel_pofile.getPOTMsgSetTranslated())
- self.assertEquals(found_translations, [self.potmsgset])
+ self.assertEqual(found_translations, [self.potmsgset])
def test_getPOTMsgSetTranslated_EmptyShared(self):
# Test listing of translated POTMsgSets when there is an
@@ -479,7 +479,7 @@
# but since it's empty, there are no results.
found_translations = list(
self.devel_pofile.getPOTMsgSetTranslated())
- self.assertEquals(found_translations, [])
+ self.assertEqual(found_translations, [])
# When an empty diverged translation is added, nothing is listed.
self.factory.makeCurrentTranslationMessage(
@@ -487,7 +487,7 @@
translations=[u""], diverged=True)
found_translations = list(
self.devel_pofile.getPOTMsgSetTranslated())
- self.assertEquals(found_translations, [])
+ self.assertEqual(found_translations, [])
# If diverged translation is non-empty, POTMsgSet is listed.
self.factory.makeCurrentTranslationMessage(
@@ -495,7 +495,7 @@
translations=[u"Translation"], diverged=True)
found_translations = list(
self.devel_pofile.getPOTMsgSetTranslated())
- self.assertEquals(found_translations, [self.potmsgset])
+ self.assertEqual(found_translations, [self.potmsgset])
def test_getPOTMsgSetTranslated_Multiple(self):
# Test listing of translated POTMsgSets if there is more than one
@@ -518,7 +518,7 @@
# Both POTMsgSets are listed.
found_translations = list(
self.devel_pofile.getPOTMsgSetTranslated())
- self.assertEquals(found_translations, [self.potmsgset, potmsgset])
+ self.assertEqual(found_translations, [self.potmsgset, potmsgset])
def test_getPOTMsgSetUntranslated_NoShared(self):
# Test listing of translated POTMsgSets when there is no shared
@@ -527,7 +527,7 @@
# When there is no diverged translation either, nothing is returned.
found_translations = list(
self.devel_pofile.getPOTMsgSetUntranslated())
- self.assertEquals(found_translations, [self.potmsgset])
+ self.assertEqual(found_translations, [self.potmsgset])
# When a diverged translation is added, the potmsgset is returned.
self.factory.makeCurrentTranslationMessage(
@@ -535,7 +535,7 @@
translations=[u"Translation"], diverged=True)
found_translations = list(
self.devel_pofile.getPOTMsgSetUntranslated())
- self.assertEquals(found_translations, [])
+ self.assertEqual(found_translations, [])
# If diverged translation is empty, POTMsgSet is not listed.
self.factory.makeCurrentTranslationMessage(
@@ -543,7 +543,7 @@
translations=[u""], diverged=True)
found_translations = list(
self.devel_pofile.getPOTMsgSetUntranslated())
- self.assertEquals(found_translations, [self.potmsgset])
+ self.assertEqual(found_translations, [self.potmsgset])
def test_getPOTMsgSetUntranslated_Shared(self):
# Test listing of translated POTMsgSets when there is a shared
@@ -557,7 +557,7 @@
# When there is no diverged translation, shared one is returned.
found_translations = list(
self.devel_pofile.getPOTMsgSetUntranslated())
- self.assertEquals(found_translations, [])
+ self.assertEqual(found_translations, [])
# When an empty diverged translation is added, nothing is listed.
self.factory.makeCurrentTranslationMessage(
@@ -565,7 +565,7 @@
translations=[u""], diverged=True)
found_translations = list(
self.devel_pofile.getPOTMsgSetUntranslated())
- self.assertEquals(found_translations, [self.potmsgset])
+ self.assertEqual(found_translations, [self.potmsgset])
# If diverged translation is non-empty, POTMsgSet is listed.
self.factory.makeCurrentTranslationMessage(
@@ -573,7 +573,7 @@
translations=[u"Translation"], diverged=True)
found_translations = list(
self.devel_pofile.getPOTMsgSetUntranslated())
- self.assertEquals(found_translations, [])
+ self.assertEqual(found_translations, [])
def test_getPOTMsgSetUntranslated_EmptyShared(self):
# Test listing of translated POTMsgSets when there is an
@@ -588,7 +588,7 @@
# but since it's empty, there are no results.
found_translations = list(
self.devel_pofile.getPOTMsgSetUntranslated())
- self.assertEquals(found_translations, [self.potmsgset])
+ self.assertEqual(found_translations, [self.potmsgset])
# When an empty diverged translation is added, nothing is listed.
self.factory.makeCurrentTranslationMessage(
@@ -596,7 +596,7 @@
translations=[u""], diverged=True)
found_translations = list(
self.devel_pofile.getPOTMsgSetUntranslated())
- self.assertEquals(found_translations, [self.potmsgset])
+ self.assertEqual(found_translations, [self.potmsgset])
# If diverged translation is non-empty, POTMsgSet is listed.
self.factory.makeCurrentTranslationMessage(
@@ -604,7 +604,7 @@
translations=[u"Translation"], diverged=True)
found_translations = list(
self.devel_pofile.getPOTMsgSetUntranslated())
- self.assertEquals(found_translations, [])
+ self.assertEqual(found_translations, [])
def test_getPOTMsgSetUntranslated_Multiple(self):
# Test listing of untranslated POTMsgSets if there is more than one
@@ -623,7 +623,7 @@
# Both POTMsgSets are listed.
found_translations = list(
self.devel_pofile.getPOTMsgSetUntranslated())
- self.assertEquals(found_translations, [self.potmsgset, potmsgset])
+ self.assertEqual(found_translations, [self.potmsgset, potmsgset])
def test_getPOTMsgSetWithNewSuggestions(self):
# Test listing of POTMsgSets with unreviewed suggestions.
@@ -631,17 +631,17 @@
# When there are no suggestions, nothing is returned.
found_translations = list(
self.devel_pofile.getPOTMsgSetWithNewSuggestions())
- self.assertEquals(found_translations, [])
+ self.assertEqual(found_translations, [])
# When a suggestion is added, the potmsgset is returned.
translation = self.factory.makeSuggestion(
pofile=self.devel_pofile, potmsgset=self.potmsgset,
translations=[u"Suggestion"])
- self.assertEquals(translation.is_current_ubuntu, False)
+ self.assertEqual(translation.is_current_ubuntu, False)
found_translations = list(
self.devel_pofile.getPOTMsgSetWithNewSuggestions())
- self.assertEquals(found_translations, [self.potmsgset])
+ self.assertEqual(found_translations, [self.potmsgset])
def test_getPOTMsgSetWithNewSuggestions_multiple(self):
# Test that multiple unreviewed POTMsgSets are returned.
@@ -669,7 +669,7 @@
# Both POTMsgSets are listed.
found_translations = list(
self.devel_pofile.getPOTMsgSetWithNewSuggestions())
- self.assertEquals(found_translations, [self.potmsgset, potmsgset])
+ self.assertEqual(found_translations, [self.potmsgset, potmsgset])
def test_getPOTMsgSetWithNewSuggestions_distinct(self):
# Provide two suggestions on a single message and make sure
@@ -685,9 +685,8 @@
potmsgsets = list(
self.devel_pofile.getPOTMsgSetWithNewSuggestions())
- self.assertEquals(potmsgsets,
- [self.potmsgset])
- self.assertEquals(
+ self.assertEqual(potmsgsets, [self.potmsgset])
+ self.assertEqual(
self.devel_pofile.getPOTMsgSetWithNewSuggestions().count(),
1)
@@ -698,11 +697,11 @@
translation = self.factory.makeSuggestion(
pofile=self.devel_pofile, potmsgset=self.potmsgset,
translations=[])
- self.assertEquals(False, translation.is_current_ubuntu)
+ self.assertEqual(False, translation.is_current_ubuntu)
found_translations = list(
self.devel_pofile.getPOTMsgSetWithNewSuggestions())
- self.assertEquals([], found_translations)
+ self.assertEqual([], found_translations)
def _getThisSideFlag(self, translation_message):
"""Return the value of the "is_current_*" flag on this side."""
@@ -728,48 +727,48 @@
# If there are no translations on either side, nothing is listed.
found_translations = list(
self.devel_pofile.getPOTMsgSetDifferentTranslations())
- self.assertEquals(found_translations, [])
+ self.assertEqual(found_translations, [])
# Adding a current translation on one side doesn't change anything.
translation = self.factory.makeCurrentTranslationMessage(
pofile=self.devel_pofile, potmsgset=self.potmsgset,
translations=[u"This side translation"])
- self.assertEquals(self._getThisSideFlag(translation), True)
- self.assertEquals(self._getOtherSideFlag(translation), False)
+ self.assertEqual(self._getThisSideFlag(translation), True)
+ self.assertEqual(self._getOtherSideFlag(translation), False)
found_translations = list(
self.devel_pofile.getPOTMsgSetDifferentTranslations())
- self.assertEquals(found_translations, [])
+ self.assertEqual(found_translations, [])
# Adding a translation on both sides does not introduce a difference.
translation = self.factory.makeCurrentTranslationMessage(
pofile=self.devel_pofile, potmsgset=self.potmsgset,
translations=[u"Both sides translation"], current_other=True)
- self.assertEquals(self._getThisSideFlag(translation), True)
- self.assertEquals(self._getOtherSideFlag(translation), True)
+ self.assertEqual(self._getThisSideFlag(translation), True)
+ self.assertEqual(self._getOtherSideFlag(translation), True)
found_translations = list(
self.devel_pofile.getPOTMsgSetDifferentTranslations())
- self.assertEquals(found_translations, [])
+ self.assertEqual(found_translations, [])
# Adding a different translation on one side to creates a difference
# between this side and the other side.
translation = self.factory.makeCurrentTranslationMessage(
pofile=self.devel_pofile, potmsgset=self.potmsgset,
translations=[u"Different translation"])
- self.assertEquals(self._getThisSideFlag(translation), True)
- self.assertEquals(self._getOtherSideFlag(translation), False)
+ self.assertEqual(self._getThisSideFlag(translation), True)
+ self.assertEqual(self._getOtherSideFlag(translation), False)
found_translations = list(
self.devel_pofile.getPOTMsgSetDifferentTranslations())
- self.assertEquals(found_translations, [self.potmsgset])
+ self.assertEqual(found_translations, [self.potmsgset])
# A diverged translation is different, too.
translation = self.factory.makeCurrentTranslationMessage(
pofile=self.devel_pofile, potmsgset=self.potmsgset,
translations=[u"Diverged translation"], diverged=True)
- self.assertEquals(self._getThisSideFlag(translation), True)
- self.assertEquals(self._getOtherSideFlag(translation), False)
+ self.assertEqual(self._getThisSideFlag(translation), True)
+ self.assertEqual(self._getOtherSideFlag(translation), False)
found_translations = list(
self.devel_pofile.getPOTMsgSetDifferentTranslations())
- self.assertEquals(found_translations, [self.potmsgset])
+ self.assertEqual(found_translations, [self.potmsgset])
def test_messageCount(self):
# POFile.messageCount just forwards to POTmeplate.messageCount.
@@ -785,13 +784,13 @@
# Statistics for an empty template are all calculated as zero.
pofile = self.factory.makePOFile()
pofile.updateStatistics()
- self.assertEquals(0, self.devel_pofile.messageCount())
- self.assertEquals(0, self.devel_pofile.translatedCount())
- self.assertEquals(0, self.devel_pofile.untranslatedCount())
- self.assertEquals(0, self.devel_pofile.currentCount())
- self.assertEquals(0, self.devel_pofile.rosettaCount())
- self.assertEquals(0, self.devel_pofile.updatesCount())
- self.assertEquals(0, self.devel_pofile.unreviewedCount())
+ self.assertEqual(0, self.devel_pofile.messageCount())
+ self.assertEqual(0, self.devel_pofile.translatedCount())
+ self.assertEqual(0, self.devel_pofile.untranslatedCount())
+ self.assertEqual(0, self.devel_pofile.currentCount())
+ self.assertEqual(0, self.devel_pofile.rosettaCount())
+ self.assertEqual(0, self.devel_pofile.updatesCount())
+ self.assertEqual(0, self.devel_pofile.unreviewedCount())
def test_updateStatistics(self):
# Test that updating statistics keeps working.
@@ -854,15 +853,15 @@
# Returns current, updates, rosetta, unreviewed counts.
stats = self.devel_pofile.updateStatistics()
- self.assertEquals((1, 1, 3, 2), stats)
+ self.assertEqual((1, 1, 3, 2), stats)
- self.assertEquals(6, self.devel_pofile.messageCount())
- self.assertEquals(4, self.devel_pofile.translatedCount())
- self.assertEquals(2, self.devel_pofile.untranslatedCount())
- self.assertEquals(1, self.devel_pofile.currentCount())
- self.assertEquals(3, self.devel_pofile.rosettaCount())
- self.assertEquals(1, self.devel_pofile.updatesCount())
- self.assertEquals(2, self.devel_pofile.unreviewedCount())
+ self.assertEqual(6, self.devel_pofile.messageCount())
+ self.assertEqual(4, self.devel_pofile.translatedCount())
+ self.assertEqual(2, self.devel_pofile.untranslatedCount())
+ self.assertEqual(1, self.devel_pofile.currentCount())
+ self.assertEqual(3, self.devel_pofile.rosettaCount())
+ self.assertEqual(1, self.devel_pofile.updatesCount())
+ self.assertEqual(2, self.devel_pofile.unreviewedCount())
def test_TranslationFileData_adapter(self):
# Test that exporting works correctly with shared and diverged
@@ -879,9 +878,9 @@
exported_messages = [
(msg.singular_text, msg.translations[0])
for msg in translation_file_data.messages]
- self.assertEquals(exported_messages,
- [(self.potmsgset.singular_text,
- "Shared translation")])
+ self.assertEqual(exported_messages,
+ [(self.potmsgset.singular_text,
+ "Shared translation")])
# When we add a diverged translation, only that is exported.
self.factory.makeCurrentTranslationMessage(
@@ -898,9 +897,9 @@
(msg.singular_text, msg.translations[0])
for msg in translation_file_data.messages]
# Only the diverged translation is exported.
- self.assertEquals(exported_messages,
- [(self.potmsgset.singular_text,
- "Diverged translation")])
+ self.assertEqual(exported_messages,
+ [(self.potmsgset.singular_text,
+ "Diverged translation")])
class TestSharingPOFileCreation(TestCaseWithFactory):
@@ -1110,7 +1109,7 @@
self.credits_potmsgset.setCurrentTranslation(
self.pofile, translator, {0: 'upstream credits'},
RosettaTranslationOrigin.SCM, share_with_other_side=True)
- self.assertEquals(
+ self.assertEqual(
u'upstream credits\n\n'
'Launchpad Contributions:\n'
' Launchpad Translator http://launchpad.dev/~the-translator',
@@ -1140,7 +1139,7 @@
# The first translation credits export.
credits_text = self.pofile.prepareTranslationCredits(
self.credits_potmsgset)
- self.assertEquals(
+ self.assertEqual(
self.compose_launchpad_credits_text(imported_credits_text),
credits_text)
@@ -1153,7 +1152,7 @@
credits_text = self.pofile.prepareTranslationCredits(
self.credits_potmsgset)
- self.assertEquals(
+ self.assertEqual(
self.compose_launchpad_credits_text(imported_credits_text),
credits_text)
@@ -1169,7 +1168,7 @@
self.pofile, translator,
{0: 'Upstream credits'},
RosettaTranslationOrigin.SCM, share_with_other_side=True)
- self.assertEquals(
+ self.assertEqual(
u'Upstream credits, ,Launchpad Contributions:,'
'Launchpad Translator',
self.pofile.prepareTranslationCredits(kde_names_potmsgset))
@@ -1186,7 +1185,7 @@
self.pofile, translator,
{0: 'translator@upstream'},
RosettaTranslationOrigin.SCM, share_with_other_side=True)
- self.assertEquals(
+ self.assertEqual(
u'translator@upstream,,,translator@launchpad',
self.pofile.prepareTranslationCredits(kde_emails_potmsgset))
@@ -1203,7 +1202,7 @@
self.pofile, translator,
{0: 'Upstream credits'},
RosettaTranslationOrigin.SCM, share_with_other_side=True)
- self.assertEquals(
+ self.assertEqual(
u'Upstream credits, ,Launchpad Contributions:,'
'Launchpad Translator',
self.pofile.prepareTranslationCredits(kde_names_potmsgset))
@@ -1221,7 +1220,7 @@
self.pofile, translator,
{0: 'translator@upstream'},
RosettaTranslationOrigin.SCM, share_with_other_side=True)
- self.assertEquals(
+ self.assertEqual(
u'translator@upstream,,,translator@launchpad',
self.pofile.prepareTranslationCredits(kde_emails_potmsgset))
@@ -1275,7 +1274,7 @@
translated_potmsgsets = list(
self.devel_pofile.getPOTMsgSetTranslated())
- self.assertEquals(
+ self.assertEqual(
[self.potmsgset1, self.potmsgset2], translated_potmsgsets)
# Insert these two POTMsgSets into self.stable_potemplate in reverse
@@ -1286,20 +1285,20 @@
# And they are returned in the new order as desired.
translated_potmsgsets = list(
self.stable_pofile.getPOTMsgSetTranslated())
- self.assertEquals(
+ self.assertEqual(
[self.potmsgset2, self.potmsgset1], translated_potmsgsets)
# Order is unchanged for the previous template.
translated_potmsgsets = list(
self.devel_pofile.getPOTMsgSetTranslated())
- self.assertEquals(
+ self.assertEqual(
[self.potmsgset1, self.potmsgset2], translated_potmsgsets)
def test_getPOTMsgSetUntranslated_ordering(self):
# Both POTMsgSets in devel_pofile are untranslated.
untranslated_potmsgsets = list(
self.devel_pofile.getPOTMsgSetUntranslated())
- self.assertEquals(
+ self.assertEqual(
[self.potmsgset1, self.potmsgset2], untranslated_potmsgsets)
# Insert these two POTMsgSets into self.stable_potemplate in reverse
@@ -1310,13 +1309,13 @@
# And they are returned in the new order as desired.
untranslated_potmsgsets = list(
self.stable_pofile.getPOTMsgSetUntranslated())
- self.assertEquals(
+ self.assertEqual(
[self.potmsgset2, self.potmsgset1], untranslated_potmsgsets)
# Order is unchanged for the previous template.
untranslated_potmsgsets = list(
self.devel_pofile.getPOTMsgSetUntranslated())
- self.assertEquals(
+ self.assertEqual(
[self.potmsgset1, self.potmsgset2], untranslated_potmsgsets)
def test_getPOTMsgSetDifferentTranslations_ordering(self):
@@ -1343,7 +1342,7 @@
potmsgsets = list(
self.devel_pofile.getPOTMsgSetDifferentTranslations())
- self.assertEquals(
+ self.assertEqual(
[self.potmsgset1, self.potmsgset2], potmsgsets)
# Insert these two POTMsgSets into self.stable_potemplate in reverse
@@ -1354,20 +1353,20 @@
# And they are returned in the new order as desired.
potmsgsets = list(
self.stable_pofile.getPOTMsgSetDifferentTranslations())
- self.assertEquals(
+ self.assertEqual(
[self.potmsgset2, self.potmsgset1], potmsgsets)
# Order is unchanged for the previous template.
potmsgsets = list(
self.devel_pofile.getPOTMsgSetDifferentTranslations())
- self.assertEquals(
+ self.assertEqual(
[self.potmsgset1, self.potmsgset2], potmsgsets)
def test_getPOTMsgSets_ordering(self):
# Both POTMsgSets in devel_potemplate are untranslated.
potmsgsets = list(
self.devel_potemplate.getPOTMsgSets())
- self.assertEquals(
+ self.assertEqual(
[self.potmsgset1, self.potmsgset2], potmsgsets)
# Insert these two POTMsgSets into self.stable_potemplate in reverse
@@ -1378,13 +1377,13 @@
# And they are returned in the new order as desired.
potmsgsets = list(
self.stable_potemplate.getPOTMsgSets())
- self.assertEquals(
+ self.assertEqual(
[self.potmsgset2, self.potmsgset1], potmsgsets)
# Order is unchanged for the previous template.
potmsgsets = list(
self.devel_potemplate.getPOTMsgSets())
- self.assertEquals(
+ self.assertEqual(
[self.potmsgset1, self.potmsgset2], potmsgsets)
@@ -1583,7 +1582,7 @@
sampledata_pofiles = list(
self.pofileset.getPOFilesWithTranslationCredits())
total = len(sampledata_pofiles)
- self.assertEquals(3, total)
+ self.assertEqual(3, total)
def list_of_tuples_into_list(list_of_tuples):
return [item[0] for item in list_of_tuples]
@@ -1598,7 +1597,7 @@
self.assertIn(sr_pofile,
list_of_tuples_into_list(
self.pofileset.getPOFilesWithTranslationCredits()))
- self.assertEquals(
+ self.assertEqual(
total + 1,
self.pofileset.getPOFilesWithTranslationCredits().count())
@@ -1794,7 +1793,7 @@
# Make sure count of translations which are active both
# in import and in Launchpad is correct.
self.pofile.updateStatistics()
- self.assertEquals(self.pofile.currentCount(), 0)
+ self.assertEqual(self.pofile.currentCount(), 0)
# Adding an imported translation increases currentCount().
self.factory.makeCurrentTranslationMessage(
@@ -1803,7 +1802,7 @@
translations=["Imported current"],
current_other=True)
self.pofile.updateStatistics()
- self.assertEquals(self.pofile.currentCount(), 1)
+ self.assertEqual(self.pofile.currentCount(), 1)
# Adding a suggestion (i.e. unused translation)
# will not change the current count when there's
@@ -1813,13 +1812,13 @@
potmsgset=self.potmsgset,
translations=["A suggestion"])
self.pofile.updateStatistics()
- self.assertEquals(self.pofile.currentCount(), 1)
+ self.assertEqual(self.pofile.currentCount(), 1)
def test_POFile_updateStatistics_newCount(self):
# Make sure count of translations which are provided
# only in Launchpad (and not in imports) is correct.
self.pofile.updateStatistics()
- self.assertEquals(self.pofile.newCount(), 0)
+ self.assertEqual(self.pofile.newCount(), 0)
# Adding a current translation for an untranslated
# message increases the count of new translations in LP.
@@ -1828,7 +1827,7 @@
potmsgset=self.potmsgset,
translations=["Current"])
self.pofile.updateStatistics()
- self.assertEquals(self.pofile.newCount(), 1)
+ self.assertEqual(self.pofile.newCount(), 1)
def test_POFile_updateStatistics_newCount_reimporting(self):
# If we get an 'imported' translation for what
@@ -1846,7 +1845,7 @@
current_other=True)
self.pofile.updateStatistics()
- self.assertEquals(self.pofile.newCount(), 0)
+ self.assertEqual(self.pofile.newCount(), 0)
def test_POFile_updateStatistics_newCount_changed(self):
# If we change an 'imported' translation through
@@ -1862,8 +1861,8 @@
potmsgset=self.potmsgset,
translations=["Changed"])
self.pofile.updateStatistics()
- self.assertEquals(self.pofile.newCount(), 0)
- self.assertEquals(self.pofile.updatesCount(), 1)
+ self.assertEqual(self.pofile.newCount(), 0)
+ self.assertEqual(self.pofile.updatesCount(), 1)
def test_empty_messages_count_as_untranslated(self):
# A message with all its msgstr* set to None counts as if
@@ -2326,7 +2325,7 @@
this_pofile = self.makeThisSidePOFile()
other_pofile = self.makeOtherSidePOFile()
self._setPackagingLink()
- self.assertEquals(other_pofile, this_pofile.getOtherSidePOFile())
+ self.assertEqual(other_pofile, this_pofile.getOtherSidePOFile())
def test_getOtherSidePOFile_automatic(self):
# As expected, sharing POFiles are created automatically if the
@@ -2334,7 +2333,7 @@
self._setPackagingLink()
other_potemplate = self.makeOtherSidePOTemplate()
this_pofile = self.makeThisSidePOFile(create_sharing=True)
- self.assertEquals(
+ self.assertEqual(
other_potemplate, this_pofile.getOtherSidePOFile().potemplate)
=== modified file 'lib/lp/translations/tests/test_potemplate.py'
--- lib/lp/translations/tests/test_potemplate.py 2018-01-02 10:54:31 +0000
+++ lib/lp/translations/tests/test_potemplate.py 2018-01-02 16:24:23 +0000
@@ -40,7 +40,7 @@
# Avoid circular imports.
from lp.translations.model.pofile import DummyPOFile
- self.assertEquals(DummyPOFile, type(pofile))
+ self.assertEqual(DummyPOFile, type(pofile))
def test_composePOFilePath(self):
esperanto = getUtility(ILanguageSet).getLanguageByCode('eo')
@@ -667,7 +667,7 @@
this_potemplate = self.makeThisSidePOTemplate()
other_potemplate = self.makeOtherSidePOTemplate()
self._setPackagingLink()
- self.assertEquals(
+ self.assertEqual(
other_potemplate, this_potemplate.getOtherSidePOTemplate())
=== modified file 'lib/lp/translations/tests/test_potmsgset.py'
--- lib/lp/translations/tests/test_potmsgset.py 2015-10-14 16:23:18 +0000
+++ lib/lp/translations/tests/test_potmsgset.py 2018-01-02 16:24:23 +0000
@@ -79,8 +79,8 @@
devel_potmsgsets = list(self.devel_potemplate.getPOTMsgSets())
stable_potmsgsets = list(self.stable_potemplate.getPOTMsgSets())
- self.assertEquals(devel_potmsgsets, [self.potmsgset])
- self.assertEquals(devel_potmsgsets, stable_potmsgsets)
+ self.assertEqual(devel_potmsgsets, [self.potmsgset])
+ self.assertEqual(devel_potmsgsets, stable_potmsgsets)
def test_POTMsgSetInIncompatiblePOTemplates(self):
# Make sure a POTMsgSet cannot be used in two POTemplates with
@@ -100,7 +100,7 @@
devel_potmsgsets = list(self.devel_potemplate.getPOTMsgSets())
stable_potmsgsets = list(self.stable_potemplate.getPOTMsgSets())
- self.assertEquals(devel_potmsgsets, stable_potmsgsets)
+ self.assertEqual(devel_potmsgsets, stable_potmsgsets)
# We hack the POTemplate manually to make data inconsistent
# in database.
@@ -194,11 +194,11 @@
devel_translation = self.potmsgset.getCurrentTranslation(
self.devel_potemplate, serbian,
self.devel_potemplate.translation_side)
- self.assertEquals(devel_translation, shared_translation)
+ self.assertEqual(devel_translation, shared_translation)
stable_translation = self.potmsgset.getCurrentTranslation(
self.stable_potemplate, serbian,
self.stable_potemplate.translation_side)
- self.assertEquals(stable_translation, shared_translation)
+ self.assertEqual(stable_translation, shared_translation)
# Adding a diverged translation in one template makes that one
# current in it.
@@ -207,11 +207,11 @@
devel_translation = self.potmsgset.getCurrentTranslation(
self.devel_potemplate, serbian,
self.devel_potemplate.translation_side)
- self.assertEquals(devel_translation, diverged_translation)
+ self.assertEqual(devel_translation, diverged_translation)
stable_translation = self.potmsgset.getCurrentTranslation(
self.stable_potemplate, serbian,
self.stable_potemplate.translation_side)
- self.assertEquals(stable_translation, shared_translation)
+ self.assertEqual(stable_translation, shared_translation)
def test_getOtherTranslation(self):
# Get the translation on the other side.
@@ -229,20 +229,20 @@
# A shared translation is current on both sides.
shared_translation = self.factory.makeCurrentTranslationMessage(
pofile=pofile, potmsgset=self.potmsgset, current_other=True)
- self.assertEquals(self.potmsgset.getCurrentTranslation(
+ self.assertEqual(self.potmsgset.getCurrentTranslation(
ubuntu_potemplate, ubuntu_pofile.language,
ubuntu_potemplate.translation_side), shared_translation)
- self.assertEquals(self.potmsgset.getOtherTranslation(
+ self.assertEqual(self.potmsgset.getOtherTranslation(
pofile.language, self.devel_potemplate.translation_side),
shared_translation)
# A diverted translation on the other side is not returned.
diverged_translation = self.factory.makeCurrentTranslationMessage(
pofile=ubuntu_pofile, potmsgset=self.potmsgset, diverged=True)
- self.assertEquals(self.potmsgset.getCurrentTranslation(
+ self.assertEqual(self.potmsgset.getCurrentTranslation(
ubuntu_potemplate, ubuntu_pofile.language,
ubuntu_potemplate.translation_side), diverged_translation)
- self.assertEquals(self.potmsgset.getOtherTranslation(
+ self.assertEqual(self.potmsgset.getOtherTranslation(
pofile.language, self.devel_potemplate.translation_side),
shared_translation)
@@ -255,7 +255,7 @@
# A shared translation matches the current one.
shared_translation = self.factory.makeCurrentTranslationMessage(
pofile=sr_pofile, potmsgset=self.potmsgset)
- self.assertEquals(
+ self.assertEqual(
self.potmsgset.getSharedTranslation(
serbian, self.stable_potemplate.translation_side),
shared_translation)
@@ -263,7 +263,7 @@
# Adding a diverged translation doesn't break getSharedTM.
self.factory.makeCurrentTranslationMessage(
pofile=sr_pofile, potmsgset=self.potmsgset, diverged=True)
- self.assertEquals(
+ self.assertEqual(
self.potmsgset.getSharedTranslation(
serbian, self.stable_potemplate.translation_side),
shared_translation)
@@ -359,10 +359,10 @@
# When there is no translation for the external POTMsgSet,
# no externally used suggestions are returned.
- self.assertEquals(
+ self.assertEqual(
self.potmsgset.getExternallyUsedTranslationMessages(language),
[])
- self.assertEquals(
+ self.assertEqual(
self.potmsgset.getExternallySuggestedOrUsedTranslationMessages(
used_languages=[language])[language].used,
[])
@@ -374,10 +374,10 @@
transaction.commit()
- self.assertEquals(
+ self.assertEqual(
self.potmsgset.getExternallyUsedTranslationMessages(language),
[])
- self.assertEquals(
+ self.assertEqual(
self.potmsgset.getExternallySuggestedOrUsedTranslationMessages(
used_languages=[language])[language].used,
[])
@@ -390,10 +390,10 @@
transaction.commit()
- self.assertEquals(
+ self.assertEqual(
self.potmsgset.getExternallyUsedTranslationMessages(language),
[other_translation])
- self.assertEquals(
+ self.assertEqual(
self.potmsgset.getExternallySuggestedOrUsedTranslationMessages(
used_languages=[language])[language].used,
[other_translation])
@@ -432,11 +432,11 @@
# When there is no translation for the external POTMsgSet,
# no externally used suggestions are returned.
- self.assertEquals(
+ self.assertEqual(
self.potmsgset.getExternallySuggestedTranslationMessages(
language),
[])
- self.assertEquals(
+ self.assertEqual(
self.potmsgset.getExternallySuggestedOrUsedTranslationMessages(
suggested_languages=[language])[language].suggested,
[])
@@ -448,11 +448,11 @@
transaction.commit()
- self.assertEquals(
+ self.assertEqual(
self.potmsgset.getExternallySuggestedTranslationMessages(
language),
[external_suggestion])
- self.assertEquals(
+ self.assertEqual(
self.potmsgset.getExternallySuggestedOrUsedTranslationMessages(
suggested_languages=[language])[language].suggested,
[external_suggestion])
@@ -464,11 +464,11 @@
removeSecurityProxy(other_translation).is_current_ubuntu = True
transaction.commit()
- self.assertEquals(
+ self.assertEqual(
self.potmsgset.getExternallySuggestedTranslationMessages(
language),
[external_suggestion])
- self.assertEquals(
+ self.assertEqual(
self.potmsgset.getExternallySuggestedOrUsedTranslationMessages(
suggested_languages=[language])[language].suggested,
[external_suggestion])
@@ -480,11 +480,11 @@
transaction.commit()
- self.assertEquals(
+ self.assertEqual(
self.potmsgset.getExternallySuggestedTranslationMessages(
language),
[external_suggestion])
- self.assertEquals(
+ self.assertEqual(
self.potmsgset.getExternallySuggestedOrUsedTranslationMessages(
suggested_languages=[language])[language].suggested,
[external_suggestion])
@@ -496,7 +496,7 @@
serbian = sr_pofile.language
# When there is no translation, it's not considered changed.
- self.assertEquals(
+ self.assertEqual(
self.potmsgset.hasTranslationChangedInLaunchpad(
self.devel_potemplate, serbian),
False)
@@ -505,7 +505,7 @@
# changed in Ubuntu.
self.factory.makeCurrentTranslationMessage(
pofile=sr_pofile, potmsgset=self.potmsgset)
- self.assertEquals(
+ self.assertEqual(
self.potmsgset.hasTranslationChangedInLaunchpad(
self.devel_potemplate, serbian),
False)
@@ -515,7 +515,7 @@
imported_shared = self.factory.makeCurrentTranslationMessage(
pofile=sr_pofile, potmsgset=self.potmsgset,
current_other=True)
- self.assertEquals(
+ self.assertEqual(
self.potmsgset.hasTranslationChangedInLaunchpad(
self.devel_potemplate, serbian),
False)
@@ -524,7 +524,7 @@
# non-current one, it's changed in Ubuntu.
self.factory.makeCurrentTranslationMessage(
pofile=sr_pofile, potmsgset=self.potmsgset, diverged=True)
- self.assertEquals(
+ self.assertEqual(
self.potmsgset.hasTranslationChangedInLaunchpad(
self.devel_potemplate, serbian),
True)
@@ -535,7 +535,7 @@
pofile=sr_pofile, potmsgset=self.potmsgset)
self.assertTrue(current.is_current_upstream)
self.assertTrue(imported_shared.is_current_ubuntu)
- self.assertEquals(
+ self.assertEqual(
self.potmsgset.hasTranslationChangedInLaunchpad(
self.devel_potemplate, serbian),
True)
@@ -550,7 +550,7 @@
self.devel_potemplate, sr_pofile.language,
TranslationSide.UPSTREAM)
self.assertNotEqual(None, current)
- self.assertEquals(
+ self.assertEqual(
RosettaTranslationOrigin.LAUNCHPAD_GENERATED, current.origin)
def test_setTranslationCreditsToTranslated_noop_when_translated(self):
@@ -565,7 +565,7 @@
current = credits_potmsgset.getCurrentTranslation(
self.devel_potemplate, sr_pofile.language,
TranslationSide.UPSTREAM)
- self.assertEquals(old_credits, current)
+ self.assertEqual(old_credits, current)
def test_setTranslationCreditsToTranslated_noop_when_not_credits(self):
"""Test that translation doesn't change on a non-credits message."""
@@ -596,7 +596,7 @@
sr_pofile.potemplate, sr_pofile.language,
sr_pofile.potemplate.translation_side)
self.assertTrue(test_diverged_credits.is_current_upstream)
- self.assertEquals(
+ self.assertEqual(
sr_pofile.potemplate, test_diverged_credits.potemplate)
credits_potmsgset.setTranslationCreditsToTranslated(sr_pofile)
@@ -604,7 +604,7 @@
# Shared translation is generated.
shared = credits_potmsgset.getSharedTranslation(
sr_pofile.language, sr_pofile.potemplate.translation_side)
- self.assertNotEquals(diverged_credits, shared)
+ self.assertNotEqual(diverged_credits, shared)
self.assertIsNot(None, shared)
def test_setTranslationCreditsToTranslated_submitter(self):
@@ -1002,7 +1002,7 @@
english_msgid = self.factory.getUniqueString()
potmsgset = self._makePOTMsgSet(
english_msgid, TranslationFileFormat.PO)
- self.assertEquals(english_msgid, potmsgset.singular_text)
+ self.assertEqual(english_msgid, potmsgset.singular_text)
def test_singular_text_xpi(self):
# Mozilla XPI format uses English strings as msgids if no English
@@ -1010,7 +1010,7 @@
symbolic_msgid = self.factory.getUniqueString()
potmsgset = self._makePOTMsgSet(
symbolic_msgid, TranslationFileFormat.XPI)
- self.assertEquals(symbolic_msgid, potmsgset.singular_text)
+ self.assertEqual(symbolic_msgid, potmsgset.singular_text)
def test_singular_text_xpi_english(self):
# Mozilla XPI format uses English strings as msgids if no English
@@ -1025,7 +1025,7 @@
pofile=en_pofile, potmsgset=potmsgset,
translations=[english_msgid])
- self.assertEquals(english_msgid, potmsgset.singular_text)
+ self.assertEqual(english_msgid, potmsgset.singular_text)
def test_singular_text_xpi_english_diverged(self):
# A diverged (translation.potemplate != None) English translation
@@ -1043,7 +1043,7 @@
pofile=en_pofile, potmsgset=potmsgset,
translations=[diverged_msgid], diverged=True)
- self.assertEquals(english_msgid, potmsgset.singular_text)
+ self.assertEqual(english_msgid, potmsgset.singular_text)
def _setUpSharingWithUbuntu(self):
"""Create a potmsgset shared in upstream and Ubuntu."""
@@ -1091,7 +1091,7 @@
# upstream msgid, causing the test to pass even without the
# Ubuntu message being present.
del get_property_cache(self.potmsgset).singular_text
- self.assertEquals(upstream_msgid, self.potmsgset.singular_text)
+ self.assertEqual(upstream_msgid, self.potmsgset.singular_text)
def test_singular_text_xpi_english_falls_back_to_ubuntu(self):
# POTMsgSet singular_text is read from the Ubuntu English
@@ -1106,7 +1106,7 @@
pofile=self.ubuntu_pofile, potmsgset=self.potmsgset,
translations=[ubuntu_msgid])
- self.assertEquals(ubuntu_msgid, self.potmsgset.singular_text)
+ self.assertEqual(ubuntu_msgid, self.potmsgset.singular_text)
class TestPOTMsgSetTranslationCredits(TestCaseWithFactory):
@@ -1607,12 +1607,12 @@
pofile_other, pofile_other.potemplate.owner,
translations_other, origin)
- self.assertEquals(
+ self.assertEqual(
current_translation,
potmsgset.getCurrentTranslation(
pofile_other.potemplate, pofile_other.language,
self.this_side))
- self.assertEquals(
+ self.assertEqual(
other_translation,
potmsgset.getCurrentTranslation(
pofile.potemplate, pofile.language, self.other_side))
@@ -1636,7 +1636,7 @@
current = potmsgset.getCurrentTranslation(
pofile.potemplate, pofile.language, self.this_side)
- self.assertEquals(diverged_message, current)
+ self.assertEqual(diverged_message, current)
def test_shared_when_requested(self):
# getCurrentTranslation returns a shared translation even with
@@ -1657,7 +1657,7 @@
current = potmsgset.getCurrentTranslation(
None, pofile.language, self.this_side)
- self.assertEquals(shared_message, current)
+ self.assertEqual(shared_message, current)
class TestGetCurrentTranslationForUpstreams(BaseTestGetCurrentTranslation,
=== modified file 'lib/lp/translations/tests/test_productserieslanguage.py'
--- lib/lp/translations/tests/test_productserieslanguage.py 2018-01-02 10:54:31 +0000
+++ lib/lp/translations/tests/test_productserieslanguage.py 2018-01-02 16:24:23 +0000
@@ -32,14 +32,12 @@
def test_no_templates_no_translation(self):
# There are no templates and no translations.
- self.assertEquals([],
- self.productseries.productserieslanguages)
+ self.assertEqual([], self.productseries.productserieslanguages)
def test_one_template_no_translation(self):
# There is a template and no translations.
self.factory.makePOTemplate(productseries=self.productseries)
- self.assertEquals([],
- self.productseries.productserieslanguages)
+ self.assertEqual([], self.productseries.productserieslanguages)
def test_one_template_with_pofile(self):
# There is a template and one translation.
@@ -52,15 +50,15 @@
sr_pofile = self.factory.makePOFile('sr', potemplate)
psls = list(self.productseries.productserieslanguages)
- self.assertEquals(1, len(psls))
+ self.assertEqual(1, len(psls))
# ProductSeriesLanguage object correctly keeps values
# for a language, productseries itself and POFile.
sr_psl = psls[0]
- self.assertEquals(self.productseries, sr_psl.productseries)
- self.assertEquals(sr_pofile.language, sr_psl.language)
- self.assertEquals(sr_pofile, sr_psl.pofile)
- self.assertEquals([sr_pofile], list(sr_psl.pofiles))
+ self.assertEqual(self.productseries, sr_psl.productseries)
+ self.assertEqual(sr_pofile.language, sr_psl.language)
+ self.assertEqual(sr_pofile, sr_psl.pofile)
+ self.assertEqual([sr_pofile], list(sr_psl.pofiles))
def test_productserieslanguages_languages_sorting(self):
# ProductSeriesLanguages are sorted alphabetically by language.
@@ -77,7 +75,7 @@
languages = [psl.language for psl in
self.productseries.productserieslanguages]
- self.assertEquals([albanian, serbian], languages)
+ self.assertEqual([albanian, serbian], languages)
def test_two_templates_pofile_not_set(self):
# With two templates, pofile attribute doesn't get set.
@@ -95,7 +93,7 @@
# `pofile` is not set when there's more than one template.
sr_psl = psls[0]
- self.assertEquals(None, sr_psl.pofile)
+ self.assertIsNone(sr_psl.pofile)
class TestProductSeriesLanguageStatsCalculation(TestCaseWithFactory):
@@ -134,7 +132,7 @@
self.language = getUtility(ILanguageSet).getLanguageByCode('sr')
def assertPSLStatistics(self, psl, stats):
- self.assertEquals(
+ self.assertEqual(
(psl.messageCount(),
psl.translatedCount(),
psl.currentCount(),
@@ -172,7 +170,7 @@
# Getting PSL through PSLSet gives an uninitialized object.
psl = self.psl_set.getProductSeriesLanguage(
self.productseries, self.language)
- self.assertEquals(psl.messageCount(), 0)
+ self.assertEqual(psl.messageCount(), 0)
# We explicitely ask for stats to be recalculated.
psl.recalculateCounts()
=== modified file 'lib/lp/translations/tests/test_publisher.py'
--- lib/lp/translations/tests/test_publisher.py 2012-01-01 02:58:52 +0000
+++ lib/lp/translations/tests/test_publisher.py 2018-01-02 16:24:23 +0000
@@ -45,6 +45,6 @@
# Responses to requests to translations pages have the 'Vary' header
# set to include Accept-Language.
request = TranslationsBrowserRequest(StringIO.StringIO(''), {})
- self.assertEquals(
+ self.assertEqual(
request.response.getHeader('Vary'),
'Cookie, Authorization, Accept-Language')
=== modified file 'lib/lp/translations/tests/test_setcurrenttranslation.py'
--- lib/lp/translations/tests/test_setcurrenttranslation.py 2015-09-28 17:38:45 +0000
+++ lib/lp/translations/tests/test_setcurrenttranslation.py 2018-01-02 16:24:23 +0000
@@ -89,15 +89,15 @@
if new_current is None:
self.assertIs(new_current, current)
else:
- self.assertEquals(new_current, current)
+ self.assertEqual(new_current, current)
if new_diverged is None:
self.assertIs(new_diverged, diverged)
else:
- self.assertEquals(new_diverged, diverged)
+ self.assertEqual(new_diverged, diverged)
if new_other is None:
self.assertIs(new_other, other_shared)
else:
- self.assertEquals(new_other, other_shared)
+ self.assertEqual(new_other, other_shared)
self.assertContentEqual(new_divergences, divergences_elsewhere)
@@ -208,7 +208,7 @@
tm_other.is_current_upstream and tm_other.is_current_ubuntu)
self.assertTrue(
tm_other.is_current_upstream or tm_other.is_current_ubuntu)
- self.assertEquals(self.other_pofile.potemplate, tm_other.potemplate)
+ self.assertEqual(self.other_pofile.potemplate, tm_other.potemplate)
def test_c_None__n_None__o_diverged__follows(self):
# Current translation is None, and we have found no
@@ -234,7 +234,7 @@
tm_other.is_current_ubuntu)
self.assertTrue(tm_other.is_current_upstream or
tm_other.is_current_ubuntu)
- self.assertEquals(self.other_pofile.potemplate, tm_other.potemplate)
+ self.assertEqual(self.other_pofile.potemplate, tm_other.potemplate)
def test_c_None__n_shared__o_None(self):
# Current translation is None, and we have found a
@@ -252,7 +252,7 @@
# We end up with tm_suggestion being activated.
self.assertTrue(tm is not None)
- self.assertEquals(tm_suggestion, tm)
+ self.assertEqual(tm_suggestion, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
tm, None, None, [])
@@ -273,7 +273,7 @@
# We end up with tm_suggestion being activated in both contexts.
self.assertTrue(tm is not None)
- self.assertEquals(tm_suggestion, tm)
+ self.assertEqual(tm_suggestion, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
tm, None, tm, [])
@@ -295,7 +295,7 @@
# tm_suggestion becomes current.
# Current for other context one stays the same.
self.assertTrue(tm is not None)
- self.assertEquals(tm_suggestion, tm)
+ self.assertEqual(tm_suggestion, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
tm, None, tm_other, [])
@@ -317,7 +317,7 @@
# tm_suggestion becomes current.
self.assertTrue(tm is not None)
- self.assertEquals(tm_suggestion, tm)
+ self.assertEqual(tm_suggestion, tm)
# If a translation is set for the first time in upstream,
# this translation becomes current in Ubuntu too, but if the
# translation is set for the first time in Ubuntu, this does
@@ -343,7 +343,7 @@
# tm_other becomes current in this context as well,
# and remains current for the other context.
self.assertTrue(tm is not None)
- self.assertEquals(tm_other, tm)
+ self.assertEqual(tm_other, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
tm, None, tm, [])
@@ -368,7 +368,7 @@
# We end up with a shared current translation.
self.assertTrue(tm is not None)
- self.assertEquals(tm_suggestion, tm)
+ self.assertEqual(tm_suggestion, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
tm, None, None, [tm_other])
@@ -378,7 +378,7 @@
tm_other.is_current_ubuntu)
self.assertTrue(tm_other.is_current_upstream or
tm_other.is_current_ubuntu)
- self.assertEquals(self.other_pofile.potemplate, tm_other.potemplate)
+ self.assertEqual(self.other_pofile.potemplate, tm_other.potemplate)
def test_c_None__n_shared__o_diverged__follows(self):
# Current translation is None, and we have found a
@@ -398,7 +398,7 @@
# We end up with a shared current translation.
self.assertTrue(tm is not None)
- self.assertEquals(tm_suggestion, tm)
+ self.assertEqual(tm_suggestion, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
tm, None, tm, [tm_other])
@@ -408,7 +408,7 @@
tm_other.is_current_upstream and tm_other.is_current_ubuntu)
self.assertTrue(
tm_other.is_current_upstream or tm_other.is_current_ubuntu)
- self.assertEquals(self.other_pofile.potemplate, tm_other.potemplate)
+ self.assertEqual(self.other_pofile.potemplate, tm_other.potemplate)
def test_c_shared__n_None__o_None(self):
# Current translation is 'shared', and we have found
@@ -425,7 +425,7 @@
# New translation message is shared and current only for
# the active context.
self.assertTrue(tm is not None)
- self.assertNotEquals(tm_shared, tm)
+ self.assertNotEqual(tm_shared, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
tm, None, None, [])
@@ -449,7 +449,7 @@
# New translation message is shared and current for both
# active and "other" context.
self.assertTrue(tm is not None)
- self.assertNotEquals(tm_shared, tm)
+ self.assertNotEqual(tm_shared, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
tm, None, tm, [])
@@ -476,8 +476,8 @@
# the active context. Current for "other" context is left
# untouched.
self.assertTrue(tm is not None)
- self.assertNotEquals(tm_shared, tm)
- self.assertNotEquals(tm_other, tm)
+ self.assertNotEqual(tm_shared, tm)
+ self.assertNotEqual(tm_other, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
tm, None, tm_other, [])
@@ -508,8 +508,8 @@
# New translation message is shared and current only for
# the active context.
self.assertTrue(tm is not None)
- self.assertNotEquals(tm_shared, tm)
- self.assertEquals(tm_suggestion, tm)
+ self.assertNotEqual(tm_shared, tm)
+ self.assertEqual(tm_suggestion, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
tm, None, None, [])
@@ -536,8 +536,8 @@
# New translation message is shared and current only for
# the active context.
self.assertTrue(tm is not None)
- self.assertNotEquals(tm_shared, tm)
- self.assertEquals(tm_suggestion, tm)
+ self.assertNotEqual(tm_shared, tm)
+ self.assertEqual(tm_suggestion, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
tm, None, tm, [])
@@ -561,7 +561,7 @@
# New translation message is shared and current only for
# the active context.
self.assertTrue(tm is not None)
- self.assertEquals(tm_shared, tm)
+ self.assertEqual(tm_shared, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
tm, None, None, [])
@@ -581,7 +581,7 @@
# New translation message is shared and current for both contexts.
self.assertTrue(tm is not None)
- self.assertEquals(tm_shared, tm)
+ self.assertEqual(tm_shared, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
tm, None, tm, [])
@@ -606,8 +606,8 @@
# New translation message is shared and current only for
# the active context. Translation for other context is untouched.
self.assertTrue(tm is not None)
- self.assertNotEquals(tm_shared, tm)
- self.assertEquals(tm_suggestion, tm)
+ self.assertNotEqual(tm_shared, tm)
+ self.assertEqual(tm_suggestion, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
tm, None, tm_other, [])
@@ -638,8 +638,8 @@
# New translation message is shared for both contexts.
self.assertTrue(tm is not None)
- self.assertNotEquals(tm_shared, tm)
- self.assertEquals(tm_other, tm)
+ self.assertNotEqual(tm_shared, tm)
+ self.assertEqual(tm_other, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
tm, None, tm, [])
@@ -671,8 +671,8 @@
# New translation message is shared for current context,
# and identical divergence in other context is kept.
self.assertTrue(tm is not None)
- self.assertNotEquals(tm_shared, tm)
- self.assertNotEquals(tm_other_diverged, tm)
+ self.assertNotEqual(tm_shared, tm)
+ self.assertNotEqual(tm_other_diverged, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
tm, None, None, [tm_other_diverged])
@@ -700,9 +700,9 @@
# New translation message is shared and current only for
# the active context. "Other" translation is unchanged.
self.assertTrue(tm is not None)
- self.assertNotEquals(tm_shared, tm)
- self.assertNotEquals(tm_other, tm)
- self.assertNotEquals(tm_other_diverged, tm)
+ self.assertNotEqual(tm_shared, tm)
+ self.assertNotEqual(tm_other, tm)
+ self.assertNotEqual(tm_other_diverged, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
tm, None, tm_other, [tm_other_diverged])
@@ -728,8 +728,8 @@
# New translation message is shared and current only for
# the active context. "Other" translation is unchanged.
self.assertTrue(tm is not None)
- self.assertNotEquals(tm_shared, tm)
- self.assertNotEquals(tm_other_diverged, tm)
+ self.assertNotEqual(tm_shared, tm)
+ self.assertNotEqual(tm_other_diverged, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
tm, None, None, [tm_other_diverged])
@@ -756,7 +756,7 @@
# converge the diverged translation (since shared is None),
# though it's not a requirement: (tm, None, None, [])
self.assertTrue(tm is not None)
- self.assertNotEquals(tm_diverged, tm)
+ self.assertNotEqual(tm_diverged, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
None, tm, None, [])
@@ -787,8 +787,8 @@
# New translation message stays diverged and current only for
# the active context.
self.assertTrue(tm is not None)
- self.assertNotEquals(tm_diverged, tm)
- self.assertNotEquals(tm_other, tm)
+ self.assertNotEqual(tm_diverged, tm)
+ self.assertNotEqual(tm_other, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
None, tm, tm_other, [])
@@ -823,8 +823,8 @@
# converge the diverged translation (since shared is None),
# though it's not a requirement: (tm, None, None, [])
self.assertTrue(tm is not None)
- self.assertNotEquals(tm_diverged, tm)
- self.assertEquals(tm_suggestion, tm)
+ self.assertNotEqual(tm_diverged, tm)
+ self.assertEqual(tm_suggestion, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
None, tm, None, [])
@@ -854,8 +854,8 @@
# New translation message converges for the active context.
self.assertTrue(tm is not None)
- self.assertNotEquals(tm_diverged, tm)
- self.assertEquals(tm_shared, tm)
+ self.assertNotEqual(tm_diverged, tm)
+ self.assertEqual(tm_shared, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
tm, None, None, [])
@@ -883,8 +883,8 @@
# The other side is not set because we're working on a diverged
# message.
self.assertTrue(tm is not None)
- self.assertNotEquals(tm_diverged, tm)
- self.assertEquals(tm_shared, tm)
+ self.assertNotEqual(tm_diverged, tm)
+ self.assertEqual(tm_shared, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
tm, None, None, [])
@@ -916,8 +916,8 @@
# converge the diverged translation (since shared is None),
# though it's not a requirement: (tm, None, None, [])
self.assertTrue(tm is not None)
- self.assertNotEquals(tm_diverged, tm)
- self.assertEquals(tm_suggestion, tm)
+ self.assertNotEqual(tm_diverged, tm)
+ self.assertEqual(tm_suggestion, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
None, tm, tm_other, [])
@@ -953,8 +953,8 @@
# converge the diverged translation (since shared is None),
# though it's not a requirement: tm_other==tm and (tm, None, tm, [])
self.assertTrue(tm is not None)
- self.assertNotEquals(tm_diverged, tm)
- self.assertNotEquals(tm_other, tm)
+ self.assertNotEqual(tm_diverged, tm)
+ self.assertNotEqual(tm_other, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
None, tm, tm_other, [])
@@ -990,9 +990,9 @@
# New translation message is shared for current context.
self.assertTrue(tm is not None)
- self.assertNotEquals(tm_diverged, tm)
- self.assertNotEquals(tm_other, tm)
- self.assertEquals(tm_shared, tm)
+ self.assertNotEqual(tm_diverged, tm)
+ self.assertNotEqual(tm_other, tm)
+ self.assertEqual(tm_shared, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
tm, None, tm_other, [])
@@ -1028,8 +1028,8 @@
# converge the diverged translation (since shared is None),
# though it's not a requirement: (tm, None, None, [])
self.assertTrue(tm is not None)
- self.assertNotEquals(tm_diverged, tm)
- self.assertNotEquals(tm_diverged_elsewhere, tm)
+ self.assertNotEqual(tm_diverged, tm)
+ self.assertNotEqual(tm_diverged_elsewhere, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
None, tm, None, [tm_diverged_elsewhere])
@@ -1066,8 +1066,8 @@
# converge the diverged translation (since shared is None),
# though it's not a requirement: (tm, None, tm_other, [])
self.assertTrue(tm is not None)
- self.assertNotEquals(tm_diverged, tm)
- self.assertNotEquals(tm_diverged_elsewhere, tm)
+ self.assertNotEqual(tm_diverged, tm)
+ self.assertNotEqual(tm_diverged_elsewhere, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
None, tm, tm_other, [tm_diverged_elsewhere])
@@ -1101,8 +1101,8 @@
# converge the diverged translation (since shared is None),
# though it's not a requirement: (tm, None, tm_other, [])
self.assertTrue(tm is not None)
- self.assertNotEquals(tm_diverged, tm)
- self.assertNotEquals(tm_other_diverged, tm)
+ self.assertNotEqual(tm_diverged, tm)
+ self.assertNotEqual(tm_other_diverged, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
None, tm, None, [tm_other_diverged])
=== modified file 'lib/lp/translations/tests/test_shared_potemplate.py'
--- lib/lp/translations/tests/test_shared_potemplate.py 2013-10-21 04:58:19 +0000
+++ lib/lp/translations/tests/test_shared_potemplate.py 2018-01-02 16:24:23 +0000
@@ -47,8 +47,8 @@
devel_potmsgsets = list(self.devel_potemplate.getPOTMsgSets())
stable_potmsgsets = list(self.stable_potemplate.getPOTMsgSets())
- self.assertEquals(devel_potmsgsets, [self.potmsgset])
- self.assertEquals(devel_potmsgsets, stable_potmsgsets)
+ self.assertEqual(devel_potmsgsets, [self.potmsgset])
+ self.assertEqual(devel_potmsgsets, stable_potmsgsets)
def test_getPOTMsgSetByMsgIDText(self):
potmsgset = self.factory.makePOTMsgSet(self.devel_potemplate,
@@ -58,7 +58,7 @@
# We can retrieve the potmsgset by its ID text.
read_potmsgset = self.devel_potemplate.getPOTMsgSetByMsgIDText(
"Open file")
- self.assertEquals(potmsgset, read_potmsgset)
+ self.assertEqual(potmsgset, read_potmsgset)
def test_getPOTMsgSetBySequence(self):
sequence = 2
@@ -68,12 +68,12 @@
# We can retrieve the potmsgset by its sequence.
read_potmsgset = self.devel_potemplate.getPOTMsgSetBySequence(
sequence)
- self.assertEquals(potmsgset, read_potmsgset)
+ self.assertEqual(potmsgset, read_potmsgset)
# It's still not present in different sharing PO template.
read_potmsgset = self.stable_potemplate.getPOTMsgSetBySequence(
sequence)
- self.assertEquals(read_potmsgset, None)
+ self.assertIsNone(read_potmsgset)
def test_getPOTMsgSetByID(self):
potmsgset = self.factory.makePOTMsgSet(self.devel_potemplate,
@@ -82,16 +82,16 @@
# We can retrieve the potmsgset by its ID.
read_potmsgset = self.devel_potemplate.getPOTMsgSetByID(id)
- self.assertEquals(potmsgset, read_potmsgset)
+ self.assertEqual(potmsgset, read_potmsgset)
# Getting this one in a different template doesn't work.
read_potmsgset = self.stable_potemplate.getPOTMsgSetByID(id)
- self.assertEquals(read_potmsgset, None)
+ self.assertIsNone(read_potmsgset)
# Nor can you get an entry with a made up ID.
random_id = 100000 + self.factory.getUniqueInteger()
read_potmsgset = self.devel_potemplate.getPOTMsgSetByID(random_id)
- self.assertEquals(read_potmsgset, None)
+ self.assertIsNone(read_potmsgset)
def test_hasMessageID(self):
naked_potemplate = removeSecurityProxy(self.devel_potemplate)
@@ -102,11 +102,11 @@
present_context = self.potmsgset.context
has_message_id = naked_potemplate.hasMessageID(
present_msgid_singular, present_msgid_plural, present_context)
- self.assertEquals(has_message_id, True)
+ self.assertEqual(has_message_id, True)
def test_hasPluralMessage(self):
# At the moment, a POTemplate has no plural form messages.
- self.assertEquals(self.devel_potemplate.hasPluralMessage(), False)
+ self.assertEqual(self.devel_potemplate.hasPluralMessage(), False)
# Let's add a POTMsgSet with plural forms.
self.factory.makePOTMsgSet(self.devel_potemplate,
@@ -115,21 +115,21 @@
sequence=4)
# Now, template contains a plural form message.
- self.assertEquals(self.devel_potemplate.hasPluralMessage(), True)
+ self.assertEqual(self.devel_potemplate.hasPluralMessage(), True)
def test_expireAllMessages(self):
devel_potmsgsets = list(self.devel_potemplate.getPOTMsgSets())
- self.assertEquals(len(devel_potmsgsets) > 0, True)
+ self.assertEqual(len(devel_potmsgsets) > 0, True)
# Expiring all messages brings the count back to zero.
self.devel_potemplate.expireAllMessages()
devel_potmsgsets = list(self.devel_potemplate.getPOTMsgSets())
- self.assertEquals(len(devel_potmsgsets), 0)
+ self.assertEqual(len(devel_potmsgsets), 0)
# Expiring all messages even when all are already expired still works.
self.devel_potemplate.expireAllMessages()
devel_potmsgsets = list(self.devel_potemplate.getPOTMsgSets())
- self.assertEquals(len(devel_potmsgsets), 0)
+ self.assertEqual(len(devel_potmsgsets), 0)
def test_createPOTMsgSetFromMsgIDs(self):
# We need a 'naked' potemplate to make use of getOrCreatePOMsgID
@@ -141,19 +141,19 @@
msgid_singular = naked_potemplate.getOrCreatePOMsgID(singular_text)
potmsgset = self.devel_potemplate.createPOTMsgSetFromMsgIDs(
msgid_singular=msgid_singular)
- self.assertEquals(potmsgset.msgid_singular, msgid_singular)
+ self.assertEqual(potmsgset.msgid_singular, msgid_singular)
# And let's add it to the devel_potemplate.
potmsgset.setSequence(self.devel_potemplate, 5)
devel_potmsgsets = list(self.devel_potemplate.getPOTMsgSets())
- self.assertEquals(len(devel_potmsgsets), 2)
+ self.assertEqual(len(devel_potmsgsets), 2)
# Creating it with a different context also works.
msgid_context = self.factory.getUniqueString()
potmsgset_context = self.devel_potemplate.createPOTMsgSetFromMsgIDs(
msgid_singular=msgid_singular, context=msgid_context)
- self.assertEquals(potmsgset_context.msgid_singular, msgid_singular)
- self.assertEquals(potmsgset_context.context, msgid_context)
+ self.assertEqual(potmsgset_context.msgid_singular, msgid_singular)
+ self.assertEqual(potmsgset_context.context, msgid_context)
def test_getOrCreateSharedPOTMsgSet(self):
# Let's create a new POTMsgSet.
@@ -165,13 +165,13 @@
# we get back the existing one.
same_potmsgset = self.devel_potemplate.getOrCreateSharedPOTMsgSet(
singular_text, None)
- self.assertEquals(potmsgset, same_potmsgset)
+ self.assertEqual(potmsgset, same_potmsgset)
# And even if we do it in the shared template, existing
# POTMsgSet is returned.
shared_potmsgset = self.stable_potemplate.getOrCreateSharedPOTMsgSet(
singular_text, None)
- self.assertEquals(potmsgset, shared_potmsgset)
+ self.assertEqual(potmsgset, shared_potmsgset)
def test_getOrCreateSharedPOTMsgSet_initializes_file_references(self):
# When creating a POTMsgSet, getOrCreateSharedPOTMsgSet
=== modified file 'lib/lp/translations/tests/test_suggestions.py'
--- lib/lp/translations/tests/test_suggestions.py 2015-10-14 16:23:18 +0000
+++ lib/lp/translations/tests/test_suggestions.py 2018-01-02 16:24:23 +0000
@@ -59,9 +59,9 @@
# translations for it, there are no suggestions for translating
# it whatsoever.
potmsgset = self.factory.makePOTMsgSet(self.foo_template)
- self.assertEquals(
+ self.assertEqual(
potmsgset.getExternallyUsedTranslationMessages(self.nl), [])
- self.assertEquals(
+ self.assertEqual(
potmsgset.getExternallySuggestedTranslationMessages(self.nl), [])
self.assertEqual({},
potmsgset.getExternallySuggestedOrUsedTranslationMessages(
@@ -80,9 +80,9 @@
transaction.commit()
def check_used_suggested():
- self.assertEquals(len(used_suggestions), 1)
- self.assertEquals(used_suggestions[0], translation)
- self.assertEquals(len(other_suggestions), 0)
+ self.assertEqual(len(used_suggestions), 1)
+ self.assertEqual(used_suggestions[0], translation)
+ self.assertEqual(len(other_suggestions), 0)
used_suggestions = foomsg.getExternallyUsedTranslationMessages(
self.nl)
other_suggestions = foomsg.getExternallySuggestedTranslationMessages(
@@ -110,12 +110,12 @@
# There is a global (externally used) suggestion.
used_suggestions = foomsg.getExternallyUsedTranslationMessages(
self.nl)
- self.assertEquals(len(used_suggestions), 1)
+ self.assertEqual(len(used_suggestions), 1)
used_suggestions = (
foomsg.getExternallySuggestedOrUsedTranslationMessages(
used_languages=[self.nl],
suggested_languages=[self.nl])[self.nl].used)
- self.assertEquals(len(used_suggestions), 1)
+ self.assertEqual(len(used_suggestions), 1)
# Override the config option to disable global suggestions.
new_config = ("""
@@ -125,12 +125,12 @@
config.push('disabled_suggestions', new_config)
disabled_used_suggestions = (
foomsg.getExternallyUsedTranslationMessages(self.nl))
- self.assertEquals(len(disabled_used_suggestions), 0)
+ self.assertEqual(len(disabled_used_suggestions), 0)
disabled_used_suggestions = (
foomsg.getExternallySuggestedOrUsedTranslationMessages(
used_languages=[self.nl],
suggested_languages=[self.nl]))[self.nl].used
- self.assertEquals(len(disabled_used_suggestions), 0)
+ self.assertEqual(len(disabled_used_suggestions), 0)
# Restore the old configuration.
config.pop('disabled_suggestions')
@@ -145,9 +145,9 @@
transaction.commit()
def check_used_suggested():
- self.assertEquals(len(used_suggestions), 0)
- self.assertEquals(len(other_suggestions), 1)
- self.assertEquals(other_suggestions[0], suggestion)
+ self.assertEqual(len(used_suggestions), 0)
+ self.assertEqual(len(other_suggestions), 1)
+ self.assertEqual(other_suggestions[0], suggestion)
used_suggestions = foomsg.getExternallyUsedTranslationMessages(
self.nl)
other_suggestions = foomsg.getExternallySuggestedTranslationMessages(
@@ -189,14 +189,14 @@
transaction.commit()
suggestions = oof_potmsgset.getExternallyUsedTranslationMessages(
self.nl)
- self.assertEquals(len(suggestions), 1)
- self.assertEquals(suggestions[0], suggestion1)
+ self.assertEqual(len(suggestions), 1)
+ self.assertEqual(suggestions[0], suggestion1)
suggestions = (
oof_potmsgset.getExternallySuggestedOrUsedTranslationMessages(
suggested_languages=[self.nl],
used_languages=[self.nl])[self.nl].used)
- self.assertEquals(len(suggestions), 1)
- self.assertEquals(suggestions[0], suggestion1)
+ self.assertEqual(len(suggestions), 1)
+ self.assertEqual(suggestions[0], suggestion1)
def test_RevertingToUpstream(self):
# When a msgid string is unique and nobody has submitted any
@@ -219,7 +219,7 @@
upstream_translation = potmsgset.getOtherTranslation(
self.foo_nl.language, self.foo_template.translation_side)
- self.assertEquals(
+ self.assertEqual(
upstream_translation, ubuntu_translation,
"Upstream message should become current in Ubuntu if there are "
"no previous imported messages.")
=== modified file 'lib/lp/translations/tests/test_translationimportqueue.py'
--- lib/lp/translations/tests/test_translationimportqueue.py 2017-04-19 11:01:16 +0000
+++ lib/lp/translations/tests/test_translationimportqueue.py 2018-01-02 16:24:23 +0000
@@ -292,8 +292,8 @@
potemplate, pofile = self._getGuessedPOFile(
'kde-l10n-sr', 'template')
serbian = getUtility(ILanguageSet).getLanguageByCode('sr')
- self.assertEquals(potemplate, pofile.potemplate)
- self.assertEquals(serbian, pofile.language)
+ self.assertEqual(potemplate, pofile.potemplate)
+ self.assertEqual(serbian, pofile.language)
def test_KDE4_language_country(self):
# If package name is kde-l10n-engb, it needs to be mapped
@@ -301,8 +301,8 @@
potemplate, pofile = self._getGuessedPOFile(
'kde-l10n-engb', 'template')
real_english = getUtility(ILanguageSet).getLanguageByCode('en_GB')
- self.assertEquals(potemplate, pofile.potemplate)
- self.assertEquals(real_english, pofile.language)
+ self.assertEqual(potemplate, pofile.potemplate)
+ self.assertEqual(real_english, pofile.language)
def test_KDE4_language_variant(self):
# If package name is kde-l10n-ca-valencia, it needs to be mapped
@@ -311,8 +311,8 @@
'ca@valencia', 'Catalan Valencia')
potemplate, pofile = self._getGuessedPOFile(
'kde-l10n-ca-valencia', 'template')
- self.assertEquals(potemplate, pofile.potemplate)
- self.assertEquals(catalan_valencia, pofile.language)
+ self.assertEqual(potemplate, pofile.potemplate)
+ self.assertEqual(catalan_valencia, pofile.language)
def test_KDE4_language_subvariant(self):
# PO file 'sr@test/something.po' in a package named like
@@ -321,8 +321,8 @@
serbian_test = self.factory.makeLanguage('sr@test')
potemplate, pofile = self._getGuessedPOFile(
'kde-l10n-sr', 'sr@test/template')
- self.assertEquals(potemplate, pofile.potemplate)
- self.assertEquals(serbian_test, pofile.language)
+ self.assertEqual(potemplate, pofile.potemplate)
+ self.assertEqual(serbian_test, pofile.language)
def test_KDE4_language_at_sign(self):
# PO file 'blah@test/something.po' in a package named like
@@ -331,8 +331,8 @@
serbian = getUtility(ILanguageSet).getLanguageByCode('sr')
potemplate, pofile = self._getGuessedPOFile(
'kde-l10n-sr', 'source/blah@test/template')
- self.assertEquals(potemplate, pofile.potemplate)
- self.assertEquals(serbian, pofile.language)
+ self.assertEqual(potemplate, pofile.potemplate)
+ self.assertEqual(serbian, pofile.language)
class TestProductOwnerEntryImporter(TestCaseWithFactory):
@@ -464,7 +464,7 @@
path=pofile.path, productseries=pot.productseries,
potemplate=pot, pofile=pofile, uploader=uploader)
- self.assertEquals(tiqe1, tiqe2)
+ self.assertEqual(tiqe1, tiqe2)
def test_reportApprovalConflict_sets_error_output_just_once(self):
# Repeated occurrence of the same approval conflict will not
=== modified file 'lib/lp/translations/tests/test_translationmessage.py'
--- lib/lp/translations/tests/test_translationmessage.py 2015-10-14 16:23:18 +0000
+++ lib/lp/translations/tests/test_translationmessage.py 2018-01-02 16:24:23 +0000
@@ -85,7 +85,7 @@
language = self.factory.makeLanguage('sr@test')
pofile = self.factory.makePOFile(language.code)
tm = self.factory.makeCurrentTranslationMessage(pofile=pofile)
- self.assertEquals(pofile, tm.getOnePOFile())
+ self.assertEqual(pofile, tm.getOnePOFile())
def test_getOnePOFile_shared(self):
language = self.factory.makeLanguage('sr@test')
@@ -103,7 +103,7 @@
pofile = self.factory.makePOFile(language.code)
tm = self.factory.makeCurrentTranslationMessage(pofile=pofile)
tm.potmsgset.setSequence(pofile.potemplate, 0)
- self.assertEquals(None, tm.getOnePOFile())
+ self.assertIsNone(tm.getOnePOFile())
def test_clone(self):
"""Cloning a translation should produce a near-identical copy."""
=== modified file 'lib/lp/translations/tests/test_translationtemplatesbuild.py'
--- lib/lp/translations/tests/test_translationtemplatesbuild.py 2016-08-12 12:56:41 +0000
+++ lib/lp/translations/tests/test_translationtemplatesbuild.py 2018-01-02 16:24:23 +0000
@@ -122,7 +122,7 @@
self.assertEqual(
build.build_farm_job, removeSecurityProxy(bq)._build_farm_job)
ubuntu = getUtility(ILaunchpadCelebrities).ubuntu
- self.assertEquals(
+ self.assertEqual(
ubuntu.currentseries.nominatedarchindep.processor, bq.processor)
def test_score(self):
=== modified file 'lib/lp/translations/utilities/tests/test_export_file_storage.py'
--- lib/lp/translations/utilities/tests/test_export_file_storage.py 2014-06-10 11:25:51 +0000
+++ lib/lp/translations/utilities/tests/test_export_file_storage.py 2018-01-02 16:24:23 +0000
@@ -52,9 +52,9 @@
storage = ExportFileStorage()
storage.addFile('/tmp/a/test/file.po', 'po', 'test file', mime)
outfile = storage.export()
- self.assertEquals(outfile.path, '/tmp/a/test/file.po')
- self.assertEquals(outfile.file_extension, 'po')
- self.assertEquals(outfile.read(), 'test file')
+ self.assertEqual(outfile.path, '/tmp/a/test/file.po')
+ self.assertEqual(outfile.file_extension, 'po')
+ self.assertEqual(outfile.read(), 'test file')
def testTarball(self):
"""Test export of tarball."""
=== modified file 'lib/lp/translations/utilities/tests/test_xpi_dtd_format.py'
--- lib/lp/translations/utilities/tests/test_xpi_dtd_format.py 2011-08-12 11:19:40 +0000
+++ lib/lp/translations/utilities/tests/test_xpi_dtd_format.py 2018-01-02 16:24:23 +0000
@@ -31,11 +31,10 @@
dtd_file = DtdFile('test.dtd', None, content)
# There is a single message.
- self.assertEquals(len(dtd_file.messages), 1)
+ self.assertEqual(len(dtd_file.messages), 1)
message = dtd_file.messages[0]
- self.assertEquals(
- [u'\xbfQuieres? \xa1S\xed!'], message.translations)
+ self.assertEqual([u'\xbfQuieres? \xa1S\xed!'], message.translations)
def test_Latin1DtdFileTest(self):
"""This test makes sure that we detect bad encodings."""
=== modified file 'lib/lp/translations/utilities/tests/test_xpi_import.py'
--- lib/lp/translations/utilities/tests/test_xpi_import.py 2018-01-02 10:54:31 +0000
+++ lib/lp/translations/utilities/tests/test_xpi_import.py 2018-01-02 16:24:23 +0000
@@ -92,16 +92,16 @@
# Plural forms should be None as this format is not able to handle
# them.
- self.assertEquals(message.msgid_plural, None)
- self.assertEquals(message.plural_text, None)
+ self.assertIsNone(message.msgid_plural)
+ self.assertIsNone(message.plural_text)
# There is no way to know whether a comment is from a
# translator or a developer comment, so we have comenttext
# always as None and store all comments as source comments.
- self.assertEquals(message.commenttext, u'')
+ self.assertEqual(message.commenttext, u'')
# This format doesn't support any functionality like .po flags.
- self.assertEquals(message.flagscomment, u'')
+ self.assertEqual(message.flagscomment, u'')
def test_TemplateImport(self):
"""Test XPI template file import."""
@@ -109,7 +109,7 @@
entry = self.setUpTranslationImportQueueForTemplate('en-US')
# The status is now IMPORTED:
- self.assertEquals(entry.status, RosettaImportStatus.IMPORTED)
+ self.assertEqual(entry.status, RosettaImportStatus.IMPORTED)
# Let's validate the content of the messages.
potmsgsets = list(self.firefox_template.getPOTMsgSets())
@@ -124,65 +124,65 @@
if message.msgid_singular.msgid == u'foozilla.name':
# It's a normal message that lacks any comment.
- self.assertEquals(message.singular_text, u'FooZilla!')
- self.assertEquals(
+ self.assertEqual(message.singular_text, u'FooZilla!')
+ self.assertEqual(
message.filereferences,
u'jar:chrome/en-US.jar!/test1.dtd(foozilla.name)')
- self.assertEquals(message.sourcecomment, None)
+ self.assertIsNone(message.sourcecomment)
elif message.msgid_singular.msgid == u'foozilla.play.fire':
# This one is also a normal message that has a comment.
- self.assertEquals(
+ self.assertEqual(
message.singular_text, u'Do you want to play with fire?')
- self.assertEquals(
+ self.assertEqual(
message.filereferences,
u'jar:chrome/en-US.jar!/test1.dtd(foozilla.play.fire)')
- self.assertEquals(
+ self.assertEqual(
message.sourcecomment,
u" Translators, don't play with fire! \n")
elif message.msgid_singular.msgid == u'foozilla.utf8':
# Now, we can see that special UTF-8 chars are extracted
# correctly.
- self.assertEquals(
+ self.assertEqual(
message.singular_text, u'\u0414\u0430\u043d=Day')
- self.assertEquals(
+ self.assertEqual(
message.filereferences,
u'jar:chrome/en-US.jar!/test1.properties:5' +
u'(foozilla.utf8)')
- self.assertEquals(message.sourcecomment, None)
+ self.assertIsNone(message.sourcecomment)
elif message.msgid_singular.msgid == u'foozilla.menu.accesskey':
# access key is a special notation that is supposed to be
# translated with a key shortcut.
- self.assertEquals(
+ self.assertEqual(
message.singular_text, u'M')
- self.assertEquals(
+ self.assertEqual(
message.filereferences,
u'jar:chrome/en-US.jar!/subdir/test2.dtd' +
u'(foozilla.menu.accesskey)')
# The comment shows the key used when there is no translation,
# which is noted as the en_US translation.
- self.assertEquals(
+ self.assertEqual(
unwrap(message.sourcecomment),
unwrap(access_key_source_comment))
elif message.msgid_singular.msgid == u'foozilla.menu.commandkey':
# command key is a special notation that is supposed to be
# translated with a key shortcut.
- self.assertEquals(
+ self.assertEqual(
message.singular_text, u'm')
- self.assertEquals(
+ self.assertEqual(
message.filereferences,
u'jar:chrome/en-US.jar!/subdir/test2.dtd' +
u'(foozilla.menu.commandkey)')
# The comment shows the key used when there is no translation,
# which is noted as the en_US translation.
- self.assertEquals(
+ self.assertEqual(
unwrap(message.sourcecomment),
unwrap(command_key_source_comment))
# Check that we got all messages.
- self.assertEquals(
+ self.assertEqual(
[u'foozilla.happytitle', u'foozilla.menu.accesskey',
u'foozilla.menu.commandkey', u'foozilla.menu.title',
u'foozilla.name', u'foozilla.nocomment', u'foozilla.play.fire',
@@ -196,7 +196,7 @@
entry = self.setUpTranslationImportQueueForTemplate('en-US')
# The status is now IMPORTED:
- self.assertEquals(entry.status, RosettaImportStatus.IMPORTED)
+ self.assertEqual(entry.status, RosettaImportStatus.IMPORTED)
# Retrieve the number of messages we got in this initial import.
first_import_potmsgsets = self.firefox_template.getPOTMsgSets(
@@ -213,7 +213,7 @@
).count()
# Both must match.
- self.assertEquals(first_import_potmsgsets, second_import_potmsgsets)
+ self.assertEqual(first_import_potmsgsets, second_import_potmsgsets)
def test_TranslationImport(self):
"""Test XPI translation file import."""
@@ -223,16 +223,16 @@
'en-US')
# The status is now IMPORTED:
- self.assertEquals(
+ self.assertEqual(
translation_entry.status, RosettaImportStatus.IMPORTED)
- self.assertEquals(template_entry.status, RosettaImportStatus.IMPORTED)
+ self.assertEqual(template_entry.status, RosettaImportStatus.IMPORTED)
# Let's validate the content of the messages.
potmsgsets = list(self.firefox_template.getPOTMsgSets())
messages = [message.msgid_singular.msgid for message in potmsgsets]
messages.sort()
- self.assertEquals(
+ self.assertEqual(
[u'foozilla.happytitle',
u'foozilla.menu.accesskey',
u'foozilla.menu.commandkey',
@@ -253,10 +253,10 @@
self.firefox_template.translation_side)
# It's a normal message that lacks any comment.
- self.assertEquals(potmsgset.singular_text, u'FooZilla!')
+ self.assertEqual(potmsgset.singular_text, u'FooZilla!')
# With this first import, upstream and Ubuntu translations must match.
- self.assertEquals(
+ self.assertEqual(
translation.translations,
potmsgset.getOtherTranslation(
self.spanish_firefox.language,
@@ -267,14 +267,14 @@
# access key is a special notation that is supposed to be
# translated with a key shortcut.
- self.assertEquals(potmsgset.singular_text, u'M')
+ self.assertEqual(potmsgset.singular_text, u'M')
# The comment shows the key used when there is no translation,
# which is noted as the en_US translation.
- self.assertEquals(
+ self.assertEqual(
unwrap(potmsgset.sourcecomment),
unwrap(access_key_source_comment))
# But for the translation import, we get the key directly.
- self.assertEquals(
+ self.assertEqual(
potmsgset.getOtherTranslation(
self.spanish_firefox.language,
self.firefox_template.translation_side).translations,
@@ -284,15 +284,15 @@
u'foozilla.menu.commandkey', context='main/subdir/test2.dtd')
# command key is a special notation that is supposed to be
# translated with a key shortcut.
- self.assertEquals(
+ self.assertEqual(
potmsgset.singular_text, u'm')
# The comment shows the key used when there is no translation,
# which is noted as the en_US translation.
- self.assertEquals(
+ self.assertEqual(
unwrap(potmsgset.sourcecomment),
unwrap(command_key_source_comment))
# But for the translation import, we get the key directly.
- self.assertEquals(
+ self.assertEqual(
potmsgset.getOtherTranslation(
self.spanish_firefox.language,
self.firefox_template.translation_side).translations,
@@ -321,7 +321,7 @@
messages = sorted([
(message.msgid_singular, message.context, message.singular_text)
for message in template.messages])
- self.assertEquals(
+ self.assertEqual(
[
(u'foozilla.clashing.key',
u'mac/extra.dtd',
=== modified file 'lib/lp/translations/utilities/tests/test_xpi_po_exporter.py'
--- lib/lp/translations/utilities/tests/test_xpi_po_exporter.py 2018-01-02 10:54:31 +0000
+++ lib/lp/translations/utilities/tests/test_xpi_po_exporter.py 2018-01-02 16:24:23 +0000
@@ -97,7 +97,7 @@
(subject, body) = self.firefox_template.importFromQueue(entry)
# The status is now IMPORTED:
- self.assertEquals(entry.status, RosettaImportStatus.IMPORTED)
+ self.assertEqual(entry.status, RosettaImportStatus.IMPORTED)
def test_Interface(self):
"""Check whether the object follows the interface."""
=== modified file 'lib/lp/translations/utilities/tests/test_xpi_properties_format.py'
--- lib/lp/translations/utilities/tests/test_xpi_properties_format.py 2015-10-14 16:23:18 +0000
+++ lib/lp/translations/utilities/tests/test_xpi_properties_format.py 2018-01-02 16:24:23 +0000
@@ -26,7 +26,7 @@
u'default-last-title-mac': [u'Conclusi\xf3n']}
parsed = dict([(message.msgid_singular, message.translations)
for message in property_file.messages])
- self.assertEquals(expected, parsed)
+ self.assertEqual(expected, parsed)
def test_UTF8PropertyFileTest(self):
"""This test makes sure that we handle UTF-8 encoding files."""
@@ -79,7 +79,7 @@
expected = {u'default-first-title-mac': [u'Introducci\xf3n']}
parsed = dict([(message.msgid_singular, message.translations)
for message in property_file.messages])
- self.assertEquals(expected, parsed)
+ self.assertEqual(expected, parsed)
def test_EscapedQuotesPropertyFileTest(self):
"""Test whether escaped quotes are well handled.
@@ -93,7 +93,7 @@
expected = {u'default-first-title-mac': [u'\'Something\' \"more\"']}
parsed = dict([(message.msgid_singular, message.translations)
for message in property_file.messages])
- self.assertEquals(expected, parsed)
+ self.assertEqual(expected, parsed)
def test_WholeLineCommentPropertyFileTest(self):
"""Test whether whole line comments are well handled."""
@@ -111,7 +111,7 @@
u'foo': None}
parsed = dict([(message.msgid_singular, message.source_comment)
for message in property_file.messages])
- self.assertEquals(expected, parsed)
+ self.assertEqual(expected, parsed)
def test_EndOfLineCommentPropertyFileTest(self):
"""Test whether end of line comments are well handled."""
@@ -132,7 +132,7 @@
[(message.msgid_singular, message.source_comment)
for message in property_file.messages])
- self.assertEquals(expected_comments, parsed_comments)
+ self.assertEqual(expected_comments, parsed_comments)
expected_translations = {
u'default-first-title-mac': [u'blah'],
@@ -142,7 +142,7 @@
message.translations)
for message in property_file.messages])
- self.assertEquals(expected_translations, parsed_translations)
+ self.assertEqual(expected_translations, parsed_translations)
def test_MultiLineCommentPropertyFileTest(self):
"""Test whether multiline comments are well handled."""
@@ -173,7 +173,7 @@
}
parsed = dict([(message.msgid_singular, message.source_comment)
for message in property_file.messages])
- self.assertEquals(expected, parsed)
+ self.assertEqual(expected, parsed)
def test_URLNotComment(self):
"""Double slash in a URL is not treated as end-of-line comment."""
@@ -183,13 +183,12 @@
property_file = PropertyFile('test.properties', None, dedent(content))
message = None
for entry in property_file.messages:
- self.assertEquals(message, None, "More messages than expected.")
+ self.assertEqual(message, None, "More messages than expected.")
message = entry
- self.assertEquals(message.msgid_singular, u"url")
- self.assertEquals(
- message.singular_text, u"https://admin.example.com/")
- self.assertEquals(message.source_comment, u"Double slash in URL!\n")
+ self.assertEqual(message.msgid_singular, u"url")
+ self.assertEqual(message.singular_text, u"https://admin.example.com/")
+ self.assertEqual(message.source_comment, u"Double slash in URL!\n")
def test_InvalidLinePropertyFileTest(self):
"""Test whether an invalid line is ignored."""
@@ -207,7 +206,7 @@
u'foo': None}
parsed = dict([(message.msgid_singular, message.source_comment)
for message in property_file.messages])
- self.assertEquals(expected, parsed)
+ self.assertEqual(expected, parsed)
def test_MultilinePropertyFileTest(self):
"""Test parsing of multiline entries."""
@@ -220,7 +219,7 @@
}
parsed = dict([(message.msgid_singular, message.translations)
for message in property_file.messages])
- self.assertEquals(expected, parsed)
+ self.assertEqual(expected, parsed)
def test_WhiteSpaceBeforeComment(self):
"""Test that single line comment is detected even with white space."""
@@ -230,7 +229,7 @@
expected = {}
parsed = dict([(message.msgid_singular, message.translations)
for message in property_file.messages])
- self.assertEquals(expected, parsed)
+ self.assertEqual(expected, parsed)
class MockFile:
=== modified file 'lib/lp/translations/utilities/tests/test_xpi_search.py'
--- lib/lp/translations/utilities/tests/test_xpi_search.py 2017-04-19 11:01:16 +0000
+++ lib/lp/translations/utilities/tests/test_xpi_search.py 2018-01-02 16:24:23 +0000
@@ -60,24 +60,24 @@
entry = self.setUpTranslationImportQueueForTemplate('en-US')
# The status is now IMPORTED:
- self.assertEquals(entry.status, RosettaImportStatus.IMPORTED)
+ self.assertEqual(entry.status, RosettaImportStatus.IMPORTED)
potmsgsets = self.spanish_firefox.findPOTMsgSetsContaining(
text='zilla')
message_list = [message.singular_text for message in potmsgsets]
- self.assertEquals([u'SomeZilla', u'FooZilla!',
- u'FooZilla Zilla Thingy'],
- message_list)
+ self.assertEqual([u'SomeZilla', u'FooZilla!',
+ u'FooZilla Zilla Thingy'],
+ message_list)
def test_templateSearchingForMsgIDs(self):
"""Searching returns no results for internal msg IDs."""
entry = self.setUpTranslationImportQueueForTemplate('en-US')
# The status is now IMPORTED:
- self.assertEquals(entry.status, RosettaImportStatus.IMPORTED)
+ self.assertEqual(entry.status, RosettaImportStatus.IMPORTED)
potmsgsets = list(self.spanish_firefox.findPOTMsgSetsContaining(
text='foozilla.title'))
- self.assertEquals(potmsgsets, [])
+ self.assertEqual(potmsgsets, [])
References