[damned-lies] chore: flake8 fixes on common
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] chore: flake8 fixes on common
- Date: Fri, 7 May 2021 12:21:44 +0000 (UTC)
commit e967ef20c434042150af91528147b1d577866a63
Author: Guillaume Bernard <associations guillaume-bernard fr>
Date: Fri Apr 30 11:29:22 2021 +0200
chore: flake8 fixes on common
common/context_processors.py | 1 +
common/tests.py | 13 ++++++-------
2 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/common/context_processors.py b/common/context_processors.py
index 1c962b78..db9d3fa4 100644
--- a/common/context_processors.py
+++ b/common/context_processors.py
@@ -1,4 +1,5 @@
from django.conf import settings
+
def utils(request):
return {'bug_url': settings.ENTER_BUG_URL}
diff --git a/common/tests.py b/common/tests.py
index 56b8f9df..d7cb211c 100644
--- a/common/tests.py
+++ b/common/tests.py
@@ -12,7 +12,6 @@ from django.utils import translation
from people.models import Person
from teams.models import Team, Role
-
from .utils import lc_sorted, pyicu_present, trans_sort_object_list
@@ -62,7 +61,7 @@ class CommonTest(DjangoTestCase):
inactive = Person.objects.create(
first_name='John', last_name='Translator',
- username='jt', last_login=datetime.now() - timedelta(days=30*6+1),
+ username='jt', last_login=datetime.now() - timedelta(days=30 * 6 + 1),
)
t1 = Team.objects.create(name='fr', description='French')
@@ -72,7 +71,7 @@ class CommonTest(DjangoTestCase):
Role.objects.create(team=t2, person=inactive)
response = self.client.get('/register/activate/a_activation_key', follow=True)
- self.assertContains(response, 'Your account has been activated.')
+ self.assertContains(response, 'Your account has been activated.')
call_command('run-maintenance')
@@ -133,7 +132,7 @@ class LcSortedTest(TestCase):
class TransSortObjectListTest(TestCase):
- def mkItem(self, name):
+ def make_item(self, name):
item = MagicMock(name=name)
item.name = name
return item
@@ -144,7 +143,7 @@ class TransSortObjectListTest(TestCase):
The given field is translated using gettext and the translation is stored
in translated_name.
"""
- item = self.mkItem("foo")
+ item = self.make_item("foo")
trans_sort_object_list([item], 'name')
self.assertEqual("bar", item.translated_name)
@@ -154,7 +153,7 @@ class TransSortObjectListTest(TestCase):
The list is sorted according to the computed translated_name
(here gettext reverses the string so foo (oof) comes before bar (rab)).
"""
- foo, bar = self.mkItem('foo'), self.mkItem('bar')
+ foo, bar = self.make_item('foo'), self.make_item('bar')
actual = trans_sort_object_list([foo, bar], 'name')
self.assertEqual([foo, bar], actual, "wrong order")
@@ -162,7 +161,7 @@ class TransSortObjectListTest(TestCase):
@patch('common.utils._', side_effect=lambda x: x)
def test_uses_localized_ordering(self, _):
"""Consider the current locale when ordering elements."""
- d, eacute, f = self.mkItem('d'), self.mkItem('é'), self.mkItem('f')
+ d, eacute, f = self.make_item('d'), self.make_item('é'), self.make_item('f')
with translation.override('fr'):
actual = trans_sort_object_list([f, eacute, d], 'name')
self.assertEqual([d, eacute, f], actual)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]