/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/test_source.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-11-16 18:59:44 UTC
  • mfrom: (7143.15.15 more-cleanups)
  • Revision ID: breezy.the.bot@gmail.com-20181116185944-biefv1sub37qfybm
Sprinkle some PEP8iness.

Merged from https://code.launchpad.net/~jelmer/brz/more-cleanups/+merge/358611

Show diffs side-by-side

added added

removed removed

Lines of Context:
89
89
        # increase it, then you almost certainly are doing something wrong as
90
90
        # the relationship from working_tree to branch is one way.
91
91
        # Note that this is an exact equality so that when the number drops,
92
 
        #it is not given a buffer but rather has this test updated immediately.
 
92
        # it is not given a buffer but rather has this test updated immediately.
93
93
        self.assertEqual(0, occurences)
94
94
 
95
95
    def test_branch_WorkingTree(self):
206
206
            else:
207
207
                if 'by Canonical' in match.group():
208
208
                    incorrect.append((fname,
209
 
                        'should not have: "by Canonical": %s'
210
 
                        % (match.group(),)))
 
209
                                      'should not have: "by Canonical": %s'
 
210
                                      % (match.group(),)))
211
211
 
212
212
        if incorrect:
213
213
            help_text = ["Some files have missing or incorrect copyright"
220
220
                         "or add '# Copyright (C)"
221
221
                         " 2007 Bazaar hackers' to these files:",
222
222
                         "",
223
 
                        ]
 
223
                         ]
224
224
            for fname, comment in incorrect:
225
225
                help_text.append(fname)
226
226
                help_text.append((' ' * 4) + comment)
276
276
 
277
277
    def _format_message(self, dict_, message):
278
278
        files = sorted(["%s: %s" % (f, ', '.join([str(i + 1) for i in lines]))
279
 
                for f, lines in dict_.items()])
 
279
                        for f, lines in dict_.items()])
280
280
        return message + '\n\n    %s' % ('\n    '.join(files))
281
281
 
282
282
    def test_coding_style(self):
310
310
        problems = []
311
311
        if tabs:
312
312
            problems.append(self._format_message(tabs,
313
 
                'Tab characters were found in the following source files.'
314
 
                '\nThey should either be replaced by "\\t" or by spaces:'))
 
313
                                                 'Tab characters were found in the following source files.'
 
314
                                                 '\nThey should either be replaced by "\\t" or by spaces:'))
315
315
        if illegal_newlines:
316
316
            problems.append(self._format_message(illegal_newlines,
317
 
                'Non-unix newlines were found in the following source files:'))
 
317
                                                 'Non-unix newlines were found in the following source files:'))
318
318
        if no_newline_at_eof:
319
319
            no_newline_at_eof.sort()
320
320
            problems.append("The following source files doesn't have a "
321
 
                "newline at the end:"
322
 
               '\n\n    %s'
323
 
               % ('\n    '.join(no_newline_at_eof)))
 
321
                            "newline at the end:"
 
322
                            '\n\n    %s'
 
323
                            % ('\n    '.join(no_newline_at_eof)))
324
324
        if problems:
325
325
            self.fail('\n\n'.join(problems))
326
326
 
441
441
            if "/tests/" in fname or "test_" in fname:
442
442
                # We don't really care about tests
443
443
                continue
444
 
            if not "from __future__ import absolute_import" in text:
 
444
            if "from __future__ import absolute_import" not in text:
445
445
                missing_absolute_import.append(fname)
446
446
 
447
447
        if missing_absolute_import: