[PATCH 2 of 9] tests: notifications: increase indentation of multi-line for loop condition

Thomas De Schampheleire patrickdepinguin at gmail.com
Thu Dec 6 08:14:22 UTC 2018


# HG changeset patch
# User Thomas De Schampheleire <thomas.de_schampheleire at nokia.com>
# Date 1543698298 -3600
#      Sat Dec 01 22:04:58 2018 +0100
# Node ID cf7e97eceeed93f74bf2db3b6ffaca4b55896a70
# Parent  d0eaee2ca6b205ad58b6e46723252e3e57bfa31c
tests: notifications: increase indentation of multi-line for loop condition

Code in question is:

for foo in [
    item1,
    item2,
    item3]:
    action1
    action2

With the above indentation, a quick glance at the code does not show where
the actions start.

Using a double indentation for line continuation avoids this problem:

for foo in [
        item1,
        item2,
        item3]:
    action1
    action2

There are no actual code changes in this commit.

diff --git a/kallithea/tests/models/test_notifications.py b/kallithea/tests/models/test_notifications.py
--- a/kallithea/tests/models/test_notifications.py
+++ b/kallithea/tests/models/test_notifications.py
@@ -208,50 +208,50 @@ class TestNotifications(TestController):
                     )
 
                 for type_, body, kwargs in [
-                    (Notification.TYPE_CHANGESET_COMMENT,
-                     u'This is the new \'comment\'.\n\n - and here it ends indented.',
-                     dict(
-                        short_id='cafe1234',
-                        raw_id='cafe1234c0ffeecafe',
-                        branch='brunch',
-                        cs_comment_user='Opinionated User (jsmith)',
-                        cs_comment_url='http://comment.org',
-                        is_mention=[False, True],
-                        message='This changeset did something clever which is hard to explain',
-                        message_short='This changeset did something cl...',
-                        status_change=[None, 'Approved'],
-                        cs_target_repo='http://example.com/repo_target',
-                        cs_url='http://changeset.com',
-                        cs_author=User.get(self.u2))),
-                    (Notification.TYPE_MESSAGE,
-                     u'This is the \'body\' of the "test" message\n - nothing interesting here except indentation.',
-                     dict()),
-                    #(Notification.TYPE_MENTION, '$body', None), # not used
-                    (Notification.TYPE_REGISTRATION,
-                     u'Registration body',
-                     dict(
-                        new_username='newbie',
-                        registered_user_url='http://newbie.org',
-                        new_email='new at email.com',
-                        new_full_name='New Full Name')),
-                    (Notification.TYPE_PULL_REQUEST,
-                     u'This PR is \'awesome\' because it does <stuff>\n - please approve indented!',
-                     dict(
-                        pr_user_created='Requesting User (root)', # pr_owner should perhaps be used for @mention in description ...
-                        is_mention=[False, True],
-                        pr_revisions=[('123abc'*7, "Introduce one and two\n\nand that's it"), ('567fed'*7, 'Make one plus two equal tree')],
-                        org_repo_name='repo_org',
-                        **pr_kwargs)),
-                    (Notification.TYPE_PULL_REQUEST_COMMENT,
-                     u'Me too!\n\n - and indented on second line',
-                     dict(
-                        closing_pr=[False, True],
-                        is_mention=[False, True],
-                        pr_comment_user='Opinionated User (jsmith)',
-                        pr_comment_url='http://pr.org/comment',
-                        status_change=[None, 'Under Review'],
-                        **pr_kwargs)),
-                    ]:
+                        (Notification.TYPE_CHANGESET_COMMENT,
+                         u'This is the new \'comment\'.\n\n - and here it ends indented.',
+                         dict(
+                            short_id='cafe1234',
+                            raw_id='cafe1234c0ffeecafe',
+                            branch='brunch',
+                            cs_comment_user='Opinionated User (jsmith)',
+                            cs_comment_url='http://comment.org',
+                            is_mention=[False, True],
+                            message='This changeset did something clever which is hard to explain',
+                            message_short='This changeset did something cl...',
+                            status_change=[None, 'Approved'],
+                            cs_target_repo='http://example.com/repo_target',
+                            cs_url='http://changeset.com',
+                            cs_author=User.get(self.u2))),
+                        (Notification.TYPE_MESSAGE,
+                         u'This is the \'body\' of the "test" message\n - nothing interesting here except indentation.',
+                         dict()),
+                        #(Notification.TYPE_MENTION, '$body', None), # not used
+                        (Notification.TYPE_REGISTRATION,
+                         u'Registration body',
+                         dict(
+                            new_username='newbie',
+                            registered_user_url='http://newbie.org',
+                            new_email='new at email.com',
+                            new_full_name='New Full Name')),
+                        (Notification.TYPE_PULL_REQUEST,
+                         u'This PR is \'awesome\' because it does <stuff>\n - please approve indented!',
+                         dict(
+                            pr_user_created='Requesting User (root)', # pr_owner should perhaps be used for @mention in description ...
+                            is_mention=[False, True],
+                            pr_revisions=[('123abc'*7, "Introduce one and two\n\nand that's it"), ('567fed'*7, 'Make one plus two equal tree')],
+                            org_repo_name='repo_org',
+                            **pr_kwargs)),
+                        (Notification.TYPE_PULL_REQUEST_COMMENT,
+                         u'Me too!\n\n - and indented on second line',
+                         dict(
+                            closing_pr=[False, True],
+                            is_mention=[False, True],
+                            pr_comment_user='Opinionated User (jsmith)',
+                            pr_comment_url='http://pr.org/comment',
+                            status_change=[None, 'Under Review'],
+                            **pr_kwargs)),
+                        ]:
                     kwargs['repo_name'] = u'repo/name'
                     params = [(type_, type_, body, kwargs)]
                     for param_name in ['is_mention', 'status_change', 'closing_pr']: # TODO: inline/general


More information about the kallithea-general mailing list