launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #21969
[Merge] lp:~cjwatson/launchpad/blueprints-tests-future-imports into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/blueprints-tests-future-imports into lp:launchpad.
Commit message:
Convert unit tests under lp.blueprints to Launchpad's preferred __future__ imports.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/blueprints-tests-future-imports/+merge/332799
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/blueprints-tests-future-imports into lp:launchpad.
=== modified file 'lib/lp/blueprints/browser/tests/test_breadcrumbs.py'
--- lib/lp/blueprints/browser/tests/test_breadcrumbs.py 2014-02-19 00:35:25 +0000
+++ lib/lp/blueprints/browser/tests/test_breadcrumbs.py 2017-10-25 16:08:20 +0000
@@ -1,6 +1,8 @@
# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
+from __future__ import absolute_import, print_function, unicode_literals
+
__metaclass__ = type
from lp.services.webapp.publisher import canonical_url
=== modified file 'lib/lp/blueprints/browser/tests/test_hasspecifications.py'
--- lib/lp/blueprints/browser/tests/test_hasspecifications.py 2012-01-01 02:58:52 +0000
+++ lib/lp/blueprints/browser/tests/test_hasspecifications.py 2017-10-25 16:08:20 +0000
@@ -1,6 +1,8 @@
# Copyright 2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
+from __future__ import absolute_import, print_function, unicode_literals
+
__metaclass__ = type
from lp.testing import (
=== modified file 'lib/lp/blueprints/browser/tests/test_menus.py'
--- lib/lp/blueprints/browser/tests/test_menus.py 2012-01-01 02:58:52 +0000
+++ lib/lp/blueprints/browser/tests/test_menus.py 2017-10-25 16:08:20 +0000
@@ -1,6 +1,8 @@
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
+from __future__ import absolute_import, print_function, unicode_literals
+
__metaclass__ = type
from lp.blueprints.browser.specification import (
=== modified file 'lib/lp/blueprints/browser/tests/test_person_upcomingwork.py'
--- lib/lp/blueprints/browser/tests/test_person_upcomingwork.py 2014-06-19 10:04:55 +0000
+++ lib/lp/blueprints/browser/tests/test_person_upcomingwork.py 2017-10-25 16:08:20 +0000
@@ -1,6 +1,8 @@
# Copyright 2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
+from __future__ import absolute_import, print_function, unicode_literals
+
__metaclass__ = type
from datetime import (
@@ -53,7 +55,7 @@
product=self.current_milestone.product,
assignee=self.team.teamowner, milestone=self.current_milestone)
workitem = self.factory.makeSpecificationWorkItem(
- title=u'workitem 1', specification=spec)
+ title='workitem 1', specification=spec)
bugtask = self.factory.makeBug(
milestone=self.current_milestone).bugtasks[0]
removeSecurityProxy(bugtask).assignee = self.team.teamowner
@@ -85,9 +87,9 @@
milestone=self.current_milestone,
assignee=self.factory.makePerson())
self.factory.makeSpecificationWorkItem(
- title=u'workitem 1', specification=spec)
+ title='workitem 1', specification=spec)
workitem = self.factory.makeSpecificationWorkItem(
- title=u'workitem 2', specification=spec,
+ title='workitem 2', specification=spec,
assignee=self.team.teamowner)
workitems = getWorkItemsDueBefore(
@@ -108,10 +110,10 @@
# This workitem is targeted to a future milestone so it won't be in
# our results below.
self.factory.makeSpecificationWorkItem(
- title=u'workitem 1', specification=spec,
+ title='workitem 1', specification=spec,
milestone=self.future_milestone)
current_wi = self.factory.makeSpecificationWorkItem(
- title=u'workitem 2', specification=spec,
+ title='workitem 2', specification=spec,
milestone=self.current_milestone)
workitems = getWorkItemsDueBefore(
@@ -133,10 +135,10 @@
product=self.current_milestone.product,
assignee=self.team.teamowner)
current_workitem = self.factory.makeSpecificationWorkItem(
- title=u'workitem 1', specification=spec,
+ title='workitem 1', specification=spec,
milestone=self.current_milestone)
future_workitem = self.factory.makeSpecificationWorkItem(
- title=u'workitem 2', specification=spec,
+ title='workitem 2', specification=spec,
milestone=self.future_milestone)
workitems = getWorkItemsDueBefore(
@@ -285,7 +287,7 @@
def test_no_xss_on_workitem_title(self):
self.factory.makeSpecificationWorkItem(
- title=u"<script>window.alert('XSS')</script>",
+ title="<script>window.alert('XSS')</script>",
assignee=self.team.teamowner, milestone=self.today_milestone)
browser = self.getViewBrowser(
=== modified file 'lib/lp/blueprints/browser/tests/test_specification.py'
--- lib/lp/blueprints/browser/tests/test_specification.py 2017-05-08 11:38:20 +0000
+++ lib/lp/blueprints/browser/tests/test_specification.py 2017-10-25 16:08:20 +0000
@@ -1,6 +1,8 @@
# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
+from __future__ import absolute_import, print_function, unicode_literals
+
__metaclass__ = type
from datetime import datetime
@@ -325,7 +327,7 @@
spec, owner, information_type=self.factory.getUniqueString())
self.assertEqual(400, status)
error_data = json.loads(body)
- self.assertEqual({u'field.information_type': u'Invalid value'},
+ self.assertEqual({'field.information_type': 'Invalid value'},
error_data['errors'])
self.assertEqual(InformationType.PUBLIC, spec.information_type)
@@ -388,8 +390,8 @@
"""Helper to check for invalid information type on submit."""
with person_logged_in(owner):
view = create_initialized_view(context, '+addspec', form=form)
- expected = (u'This information type is not permitted for'
- u' this product')
+ expected = ('This information type is not permitted for'
+ ' this product')
self.assertIn(expected, view.errors)
def test_cache_contains_information_type(self):
@@ -429,7 +431,7 @@
form = self._create_form_data(product.name)
form['field.information_type'] = 'PROPRIETARY'
view = create_initialized_view(context, '+new', form=form)
- expected = u'This information type is not permitted for this product'
+ expected = 'This information type is not permitted for this product'
self.assertIn(expected, view.errors)
@@ -855,11 +857,11 @@
def test_dict_to_DOT_attrs(self):
"""Verify that dicts are converted to a sorted DOT attr string."""
expected_attrs = (
- u' [\n'
- u' "bar"="bar \\" \\n bar",\n'
- u' "baz"="zab",\n'
- u' "foo"="foo"\n'
- u' ]')
+ ' [\n'
+ ' "bar"="bar \\" \\n bar",\n'
+ ' "baz"="zab",\n'
+ ' "foo"="foo"\n'
+ ' ]')
dict_attrs = dict(
foo="foo",
bar="bar \" \n bar",
=== modified file 'lib/lp/blueprints/browser/tests/test_specificationdependency.py'
--- lib/lp/blueprints/browser/tests/test_specificationdependency.py 2014-06-19 10:04:55 +0000
+++ lib/lp/blueprints/browser/tests/test_specificationdependency.py 2017-10-25 16:08:20 +0000
@@ -6,6 +6,8 @@
There are also tests in lp/blueprints/stories/blueprints/xx-dependencies.txt.
"""
+from __future__ import absolute_import, print_function, unicode_literals
+
__metaclass__ = type
from lp.app.enums import InformationType
=== modified file 'lib/lp/blueprints/browser/tests/test_specificationsubscription.py'
--- lib/lp/blueprints/browser/tests/test_specificationsubscription.py 2012-01-01 02:58:52 +0000
+++ lib/lp/blueprints/browser/tests/test_specificationsubscription.py 2017-10-25 16:08:20 +0000
@@ -1,6 +1,8 @@
# Copyright 2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
+from __future__ import absolute_import, print_function, unicode_literals
+
__metaclass__ = type
from lp.testing import (
=== modified file 'lib/lp/blueprints/browser/tests/test_specificationtarget.py'
--- lib/lp/blueprints/browser/tests/test_specificationtarget.py 2015-01-29 14:14:01 +0000
+++ lib/lp/blueprints/browser/tests/test_specificationtarget.py 2017-10-25 16:08:20 +0000
@@ -1,9 +1,10 @@
# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
+from __future__ import absolute_import, print_function, unicode_literals
+
__metaclass__ = type
-
from BeautifulSoup import BeautifulSoup
from fixtures import FakeLogger
from zope.component import getUtility
=== modified file 'lib/lp/blueprints/browser/tests/test_sprint.py'
--- lib/lp/blueprints/browser/tests/test_sprint.py 2017-04-10 11:17:52 +0000
+++ lib/lp/blueprints/browser/tests/test_sprint.py 2017-10-25 16:08:20 +0000
@@ -3,6 +3,8 @@
"""Tests for Sprint pages and views."""
+from __future__ import absolute_import, print_function, unicode_literals
+
__metaclass__ = type
from fixtures import FakeLogger
=== modified file 'lib/lp/blueprints/browser/tests/test_views.py'
--- lib/lp/blueprints/browser/tests/test_views.py 2015-09-29 01:38:34 +0000
+++ lib/lp/blueprints/browser/tests/test_views.py 2017-10-25 16:08:20 +0000
@@ -1,9 +1,9 @@
# Copyright 2009-2013 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
-"""
-Run the view tests.
-"""
+"""Run the view tests."""
+
+from __future__ import absolute_import, print_function, unicode_literals
import logging
import os
=== modified file 'lib/lp/blueprints/model/tests/test_specification.py'
--- lib/lp/blueprints/model/tests/test_specification.py 2015-10-26 14:54:43 +0000
+++ lib/lp/blueprints/model/tests/test_specification.py 2017-10-25 16:08:20 +0000
@@ -3,6 +3,8 @@
"""Unit tests for blueprints here."""
+from __future__ import absolute_import, print_function, unicode_literals
+
__metaclass__ = type
from lazr.lifecycle.event import ObjectModifiedEvent
@@ -182,35 +184,34 @@
layer = DatabaseFunctionalLayer
def test_specurl_validation_duplicate(self):
- existing = self.factory.makeSpecification(
- specurl=u'http://ubuntu.com')
+ existing = self.factory.makeSpecification(specurl='http://ubuntu.com')
spec = self.factory.makeSpecification()
url = canonical_url(existing)
field = ISpecification['specurl'].bind(spec)
- e = self.assertRaises(LaunchpadValidationError, field.validate,
- u'http://ubuntu.com')
+ e = self.assertRaises(
+ LaunchpadValidationError, field.validate, 'http://ubuntu.com')
self.assertEqual(
'%s is already registered by <a href="%s">%s</a>.'
- % (u'http://ubuntu.com', url, existing.title), str(e))
+ % ('http://ubuntu.com', url, existing.title), str(e))
def test_specurl_validation_valid(self):
spec = self.factory.makeSpecification()
field = ISpecification['specurl'].bind(spec)
- field.validate(u'http://example.com/nigelb')
+ field.validate('http://example.com/nigelb')
def test_specurl_validation_escape(self):
existing = self.factory.makeSpecification(
- specurl=u'http://ubuntu.com/foo',
- title='<script>alert("foo");</script>')
+ specurl='http://ubuntu.com/foo',
+ title='<script>alert("foo");</script>')
cleaned_title = '<script>alert("foo");</script>'
spec = self.factory.makeSpecification()
url = canonical_url(existing)
field = ISpecification['specurl'].bind(spec)
- e = self.assertRaises(LaunchpadValidationError, field.validate,
- u'http://ubuntu.com/foo')
+ e = self.assertRaises(
+ LaunchpadValidationError, field.validate, 'http://ubuntu.com/foo')
self.assertEqual(
'%s is already registered by <a href="%s">%s</a>.'
- % (u'http://ubuntu.com/foo', url, cleaned_title), str(e))
+ % ('http://ubuntu.com/foo', url, cleaned_title), str(e))
class TestSpecificationWorkItemsNotifications(TestCaseWithFactory):
@@ -226,7 +227,7 @@
spec = self.factory.makeSpecification()
old_spec = Snapshot(spec, providing=providedBy(spec))
new_work_item = {
- 'title': u'A work item',
+ 'title': 'A work item',
'status': SpecificationWorkItemStatus.TODO,
'assignee': None,
'milestone': None,
@@ -278,14 +279,14 @@
original_status = SpecificationWorkItemStatus.TODO
new_status = SpecificationWorkItemStatus.DONE
original_work_item = {
- 'title': u'The same work item',
+ 'title': 'The same work item',
'status': original_status,
'assignee': None,
'milestone': None,
'sequence': 0
}
new_work_item = {
- 'title': u'The same work item',
+ 'title': 'The same work item',
'status': new_status,
'assignee': None,
'milestone': None,
@@ -332,16 +333,16 @@
line = ''
if item.assignee is not None:
line = "[%s] " % item.assignee.name
- expected_lines.append(u"%s%s: %s" % (line, item.title,
+ expected_lines.append("%s%s: %s" % (line, item.title,
item.status.name))
else:
self.assertIsInstance(item, Milestone)
if expected_lines != []:
- expected_lines.append(u"")
+ expected_lines.append("")
if item == self.wi_header:
- expected_lines.append(u"Work items:")
+ expected_lines.append("Work items:")
else:
- expected_lines.append(u"Work items for %s:" % item.name)
+ expected_lines.append("Work items for %s:" % item.name)
expected = "\n".join(expected_lines)
self.assertEqual(expected, spec.workitems_text)
@@ -353,11 +354,11 @@
def test_owner_newworkitem_allowed(self):
spec = self.factory.makeSpecification()
login_person(spec.owner)
- work_item = spec.newWorkItem(title=u'new-work-item', sequence=0)
+ work_item = spec.newWorkItem(title='new-work-item', sequence=0)
self.assertIsInstance(work_item, SpecificationWorkItem)
def test_newworkitem_uses_passed_arguments(self):
- title = u'new-work-item'
+ title = 'new-work-item'
spec = self.factory.makeSpecification()
assignee = self.factory.makePerson()
milestone = self.factory.makeMilestone(product=spec.product)
@@ -406,7 +407,7 @@
milestone = self.factory.makeMilestone(product=spec.product)
login_person(spec.owner)
work_item = self.factory.makeSpecificationWorkItem(specification=spec,
- title=u'new-work-item',
+ title='new-work-item',
status=SpecificationWorkItemStatus.TODO,
milestone=milestone)
items = [milestone, work_item]
@@ -417,11 +418,11 @@
milestone = self.factory.makeMilestone(product=spec.product)
login_person(spec.owner)
work_item1 = self.factory.makeSpecificationWorkItem(specification=spec,
- title=u'Work item with default milestone',
+ title='Work item with default milestone',
status=SpecificationWorkItemStatus.TODO,
milestone=None)
work_item2 = self.factory.makeSpecificationWorkItem(specification=spec,
- title=u'Work item with set milestone',
+ title='Work item with set milestone',
status=SpecificationWorkItemStatus.TODO,
milestone=milestone)
items = [self.wi_header, work_item1, milestone, work_item2]
@@ -432,11 +433,11 @@
milestone = self.factory.makeMilestone(product=spec.product)
login_person(spec.owner)
work_item1 = self.factory.makeSpecificationWorkItem(specification=spec,
- title=u'Work item with set milestone',
+ title='Work item with set milestone',
status=SpecificationWorkItemStatus.TODO,
milestone=milestone)
work_item2 = self.factory.makeSpecificationWorkItem(specification=spec,
- title=u'Work item with default milestone',
+ title='Work item with default milestone',
status=SpecificationWorkItemStatus.TODO,
milestone=None)
items = [milestone, work_item1, self.wi_header, work_item2]
@@ -448,11 +449,11 @@
milestone2 = self.factory.makeMilestone(product=spec.product)
login_person(spec.owner)
work_item1 = self.factory.makeSpecificationWorkItem(specification=spec,
- title=u'Work item with first milestone',
+ title='Work item with first milestone',
status=SpecificationWorkItemStatus.TODO,
milestone=milestone1)
work_item2 = self.factory.makeSpecificationWorkItem(specification=spec,
- title=u'Work item with second milestone',
+ title='Work item with second milestone',
status=SpecificationWorkItemStatus.TODO,
milestone=milestone2)
items = [milestone1, work_item1, milestone2, work_item2]
@@ -487,10 +488,10 @@
product=self.factory.makeProduct())
milestone = self.factory.makeMilestone(product=spec.product)
work_item1_data = dict(
- title=u'Foo Bar', status=SpecificationWorkItemStatus.DONE,
+ title='Foo Bar', status=SpecificationWorkItemStatus.DONE,
assignee=spec.owner, milestone=None)
work_item2_data = dict(
- title=u'Bar Foo', status=SpecificationWorkItemStatus.TODO,
+ title='Bar Foo', status=SpecificationWorkItemStatus.TODO,
assignee=None, milestone=milestone)
# We start with no work items.
@@ -527,10 +528,10 @@
# These are the work items we'll be inserting.
new_wi1_data = dict(
- title=u'Some Title', status=SpecificationWorkItemStatus.TODO,
+ title='Some Title', status=SpecificationWorkItemStatus.TODO,
assignee=None, milestone=None)
new_wi2_data = dict(
- title=u'Other title', status=SpecificationWorkItemStatus.TODO,
+ title='Other title', status=SpecificationWorkItemStatus.TODO,
assignee=None, milestone=None)
# We want to insert the two work items above in the first and third
=== modified file 'lib/lp/blueprints/model/tests/test_sprint.py'
--- lib/lp/blueprints/model/tests/test_sprint.py 2017-04-10 10:49:19 +0000
+++ lib/lp/blueprints/model/tests/test_sprint.py 2017-10-25 16:08:20 +0000
@@ -3,9 +3,10 @@
"""Unit test for sprints."""
+from __future__ import absolute_import, print_function, unicode_literals
+
__metaclass__ = type
-
import datetime
from pytz import utc
@@ -180,9 +181,9 @@
blueprint1 = self.makeSpec(title='abc')
sprint = blueprint1.sprints[0]
blueprint2 = self.makeSpec(sprint, title='def')
- result = list_result(sprint, [u'abc'])
+ result = list_result(sprint, ['abc'])
self.assertEqual([blueprint1], result)
- result = list_result(sprint, [u'def'])
+ result = list_result(sprint, ['def'])
self.assertEqual([blueprint2], result)
def test_declined(self):
=== modified file 'lib/lp/blueprints/model/tests/test_subscription.py'
--- lib/lp/blueprints/model/tests/test_subscription.py 2016-01-26 15:47:37 +0000
+++ lib/lp/blueprints/model/tests/test_subscription.py 2017-10-25 16:08:20 +0000
@@ -1,6 +1,8 @@
# Copyright 2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
+from __future__ import absolute_import, print_function, unicode_literals
+
__metaclass__ = type
from zope.component import getUtility
=== modified file 'lib/lp/blueprints/tests/test_doc.py'
--- lib/lp/blueprints/tests/test_doc.py 2012-03-21 02:12:06 +0000
+++ lib/lp/blueprints/tests/test_doc.py 2017-10-25 16:08:20 +0000
@@ -1,9 +1,9 @@
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
-"""
-Run the doctests and pagetests.
-"""
+"""Run the doctests and pagetests."""
+
+from __future__ import absolute_import, print_function, unicode_literals
import os
=== modified file 'lib/lp/blueprints/tests/test_hasspecifications.py'
--- lib/lp/blueprints/tests/test_hasspecifications.py 2015-01-29 14:14:01 +0000
+++ lib/lp/blueprints/tests/test_hasspecifications.py 2017-10-25 16:08:20 +0000
@@ -3,6 +3,8 @@
"""Unit tests for objects implementing IHasSpecifications."""
+from __future__ import absolute_import, print_function, unicode_literals
+
__metaclass__ = type
from lp.blueprints.enums import SpecificationDefinitionStatus
=== modified file 'lib/lp/blueprints/tests/test_implements.py'
--- lib/lp/blueprints/tests/test_implements.py 2012-02-20 17:39:50 +0000
+++ lib/lp/blueprints/tests/test_implements.py 2017-10-25 16:08:20 +0000
@@ -3,6 +3,8 @@
"""Tests that various objects implement specification-related interfaces."""
+from __future__ import absolute_import, print_function, unicode_literals
+
__metaclass__ = type
from lp.blueprints.interfaces.specificationtarget import (
=== modified file 'lib/lp/blueprints/tests/test_publisher.py'
--- lib/lp/blueprints/tests/test_publisher.py 2012-01-01 02:58:52 +0000
+++ lib/lp/blueprints/tests/test_publisher.py 2017-10-25 16:08:20 +0000
@@ -3,6 +3,8 @@
"""Tests for blueprints' custom publications."""
+from __future__ import absolute_import, print_function, unicode_literals
+
__metaclass__ = type
from lp.blueprints.publisher import BlueprintsLayer
=== modified file 'lib/lp/blueprints/tests/test_specification.py'
--- lib/lp/blueprints/tests/test_specification.py 2015-09-28 12:21:16 +0000
+++ lib/lp/blueprints/tests/test_specification.py 2017-10-25 16:08:20 +0000
@@ -3,6 +3,8 @@
"""Unit tests for Specification."""
+from __future__ import absolute_import, print_function, unicode_literals
+
__metaclass__ = type
from datetime import (
@@ -756,9 +758,9 @@
blueprint1 = self.makeSpec(title='abc')
product = blueprint1.product
blueprint2 = self.makeSpec(product, title='def')
- result = list_result(context, [u'abc'])
+ result = list_result(context, ['abc'])
self.assertEqual([blueprint1], result)
- result = list_result(product, [u'def'])
+ result = list_result(product, ['def'])
self.assertEqual([blueprint2], result)
def test_proprietary_not_listed(self):
=== modified file 'lib/lp/blueprints/tests/test_specification_access_policy_triggers.py'
--- lib/lp/blueprints/tests/test_specification_access_policy_triggers.py 2013-06-20 05:50:00 +0000
+++ lib/lp/blueprints/tests/test_specification_access_policy_triggers.py 2017-10-25 16:08:20 +0000
@@ -1,6 +1,8 @@
# Copyright 2013 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
+from __future__ import absolute_import, print_function, unicode_literals
+
__metaclass__ = type
from zope.component import getUtility
=== modified file 'lib/lp/blueprints/tests/test_webservice.py'
--- lib/lp/blueprints/tests/test_webservice.py 2015-01-06 06:50:20 +0000
+++ lib/lp/blueprints/tests/test_webservice.py 2017-10-25 16:08:20 +0000
@@ -3,6 +3,8 @@
"""Webservice unit tests related to Launchpad blueprints."""
+from __future__ import absolute_import, print_function, unicode_literals
+
__metaclass__ = type
import json
@@ -144,8 +146,8 @@
url = '/%s/+spec/%s' % (spec.product.name, spec.name)
webservice = webservice_for_person(user)
response = webservice.get(url)
- expected_keys = [u'self_link', u'http_etag', u'resource_type_link',
- u'web_link', u'information_type']
+ expected_keys = ['self_link', 'http_etag', 'resource_type_link',
+ 'web_link', 'information_type']
self.assertEqual(response.status, 200)
self.assertContentEqual(expected_keys, response.jsonBody().keys())
=== modified file 'lib/lp/blueprints/vocabularies/tests/test_specificationdependency.py'
--- lib/lp/blueprints/vocabularies/tests/test_specificationdependency.py 2013-06-28 00:49:47 +0000
+++ lib/lp/blueprints/vocabularies/tests/test_specificationdependency.py 2017-10-25 16:08:20 +0000
@@ -6,6 +6,8 @@
There is also a doctest in specificationdepcandidates.txt.
"""
+from __future__ import absolute_import, print_function, unicode_literals
+
__metaclass__ = type
from zope.schema.vocabulary import getVocabularyRegistry
@@ -186,7 +188,7 @@
foo_b = self.factory.makeSpecification(name='foo-b')
foo_a = self.factory.makeSpecification(name='foo-a')
vocab = self.getVocabularyForSpec(spec)
- results = vocab.searchForTerms(u'foo')
+ results = vocab.searchForTerms('foo')
self.assertEqual(2, len(results))
found = [item.value for item in results]
self.assertEqual([foo_a, foo_b], found)
@@ -198,7 +200,7 @@
foo_b = self.factory.makeSpecification(name='foo-b', product=widget)
foo_a = self.factory.makeSpecification(name='foo-a')
vocab = self.getVocabularyForSpec(spec)
- results = vocab.searchForTerms(u'foo')
+ results = vocab.searchForTerms('foo')
self.assertEqual(2, len(results))
found = [item.value for item in results]
self.assertEqual([foo_b, foo_a], found)
@@ -216,7 +218,7 @@
foo_b = self.factory.makeSpecification(name='foo-b', product=widget)
foo_a = self.factory.makeSpecification(name='foo-a')
vocab = self.getVocabularyForSpec(spec)
- results = vocab.searchForTerms(u'foo')
+ results = vocab.searchForTerms('foo')
self.assertEqual(3, len(results))
found = [item.value for item in results]
self.assertEqual([foo_c, foo_b, foo_a], found)
@@ -229,7 +231,7 @@
name='foo-b', distribution=mint)
foo_a = self.factory.makeSpecification(name='foo-a')
vocab = self.getVocabularyForSpec(spec)
- results = vocab.searchForTerms(u'foo')
+ results = vocab.searchForTerms('foo')
self.assertEqual(2, len(results))
found = [item.value for item in results]
self.assertEqual([foo_b, foo_a], found)
@@ -250,7 +252,7 @@
name='foo-b', distribution=mint)
foo_a = self.factory.makeSpecification(name='foo-a')
vocab = self.getVocabularyForSpec(spec)
- results = vocab.searchForTerms(u'foo')
+ results = vocab.searchForTerms('foo')
self.assertEqual(3, len(results))
found = [item.value for item in results]
self.assertEqual([foo_c, foo_b, foo_a], found)
Follow ups