Changeset - 1c68258b14bc
[Not reviewed]
default
0 1 0
Thomas De Schampheleire - 7 years ago 2018-12-01 22:04:58
thomas.de_schampheleire@nokia.com
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.
1 file changed with 44 insertions and 44 deletions:
0 comments (0 inline, 0 general)
kallithea/tests/models/test_notifications.py
Show inline comments
 
@@ -205,56 +205,56 @@ class TestNotifications(TestController):
 
                    pr_source_branch='devbranch',
 
                    pr_owner=User.get(self.u2),
 
                    pr_owner_username='u2'
 
                    )
 

	
 
                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@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@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
 
                        if not isinstance(kwargs.get(param_name), list):
 
                            continue
 
                        new_params = []
0 comments (0 inline, 0 general)