Skip to content

Enforce E127 and E128 on Tests/ - #1780

Merged
peterjc merged 9 commits into
biopython:masterfrom
nimne:tests_E127_E128
Sep 4, 2018
Merged

peterjc merged 9 commits into
biopython:masterfrom
nimne:tests_E127_E128

Conversation

@nimne

@nimne nimne commented Sep 4, 2018

Copy link
Copy Markdown
Contributor

This pull request addresses issue #1769

These changes were made to comply with line continuation style checks, which were enabled in the Tests directory.

Changes were primarily made to whitespace, with some reorganization of long text lines. Several assert statements were also changed to the unittest equivalent.

  • I hereby agree to dual licence this and any previous contributions under both
    the Biopython License Agreement AND the BSD 3-Clause License.

  • I have read the CONTRIBUTING.rst file and understand that AppVeyor and
    TravisCI will be used to confirm the Biopython unit tests and flake8 style
    checks pass with these changes.

  • I have added my name to the alphabetical contributors listings in the files
    NEWS.rst and CONTRIB.rst as part of this pull request, am listed
    already, or do not wish to be listed. (This acknowledgement is optional.)

There are multiple ways to address the style changes for nearly everything fixed here, I welcome any feedback or suggestions.

@codecov

codecov Bot commented Sep 4, 2018

Copy link
Copy Markdown

Codecov Report

Merging #1780 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1780   +/-   ##
=======================================
  Coverage   85.43%   85.43%           
=======================================
  Files         331      331           
  Lines       50209    50209           
=======================================
  Hits        42896    42896           
  Misses       7313     7313

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 012b581...6ebf72d. Read the comment docs.

@bow bow left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @nimne, from my side this looks ok to be merged.

Comment thread Tests/.flake8
# F841 local variable name is assigned to but never used
# TODO: Fix some of these?
E127,E128,E402,E501,E731,F401,F405,F841,
E402,E501,E731,F401,F405,F841,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove E127 and E128 from the comments 9 lines up too.

Comment thread Tests/PAML/gen_results.py
ctl_file = os.path.join("Control_files", "baseml",
"{0}{1}.ctl".format(test[0], n))
ctl_file = (os.path.join("Control_files", "baseml",
"{0}{1}.ctl".format(test[0], n)))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does fixing the indentation alone (without adding brackets) make the second line too long?

Comment thread Tests/PAML/gen_results.py
bml.out_file = os.path.join("Results", "baseml", test[0],
out_file)
bml.out_file = (os.path.join("Results", "baseml", test[0],
out_file))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does fixing the indentation alone (without adding brackets) make the second line too long?

str(input_records[record.id].seq))
self.assertEqual(str(record.seq),
str(output_records[record.id].seq))
self.assertEqual(str(record.seq).replace("-", ""),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good fix - I can't use the excuse this was only supported in Python 2.7 onwards, it should probably always have been self.assertEqual

Comment thread Tests/test_GAMutation.py
assert percent_mutants > expected_percent, \
"Did not receive an acceptable number of mutations."
self.assertGreater(percent_mutants, expected_percent,
"Did not receive an acceptable number of mutations.")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good. There maybe more cases like this where now that we've dropped Python 2.6 support we can use the more specific assert methods.

20 33 -1 -1 -1 29 -1 -1 28 28 -1 7 16 5 -1 30 -1 -1 -1 14 -1 4 13 4 -1 -1 11 13 -1 5 -1 7 -1 -1 10 16 -1 4 12 15 -1 8 -1 -1 -1 16 -1 -1 10 4
>1117_10_1017_F3
33 33 -1 -1 -1 27 -1 -1 17 16 -1 28 24 11 -1 6 -1 -1 -1 29 -1 8 29 24 -1 -1 8 8 -1 20 -1 13 -1 -1 8 13 -1 28 10 24 -1 10 -1 -1 -1 4 -1 -1 7 6
33 33 -1 -1 -1 27 -1 -1 17 16 -1 28 24 11 -1 6 -1 -1 -1 29 -1 8 29 24 -1 -1 8 8 -1 20 -1 13 -1 -1 8 13 -1 28 10 24 -1 10 -1 -1 -1 4 -1 -1 7 6

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The trailing whitespace here might have been deliberate (the parser should accept it), but removing it is probably fine.

@peterjc

peterjc commented Sep 4, 2018

Copy link
Copy Markdown
Member

This looks great - a couple of tiny bits which could be even better, but this kind of pull request can easily get out of date an make more work with merge conflicts, so I'm going to apply it now. Thanks you 👍

@peterjc
peterjc merged commit 9e4e5e8 into biopython:master Sep 4, 2018
@peterjc

peterjc commented Sep 4, 2018

Copy link
Copy Markdown
Member

Thanks for looking this over @bow - two sets of eyes is sensible on a change of this size.

@nimne
nimne deleted the tests_E127_E128 branch September 4, 2018 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants