Skip to content

Update test_MarkovModel.py - #1129

Merged
peterjc merged 4 commits into
biopython:masterfrom
MaxGreil:patch-6
Apr 2, 2017
Merged

peterjc merged 4 commits into
biopython:masterfrom
MaxGreil:patch-6

Conversation

@MaxGreil

@MaxGreil MaxGreil commented Apr 2, 2017

Copy link
Copy Markdown
Contributor

Updated Tests/test_MarkovModel.py to expand unittest coverage.
See biopython issue #820

Updated Tests/test_MarkovModel.py to expand unittest coverage.
See biopython issue #820
Comment thread Tests/test_MarkovModel.py Outdated
warnings.simplefilter("ignore", UserWarning)
from Bio import MarkovModel

try:

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.

Can you use just from Bio._py3k import StringIO here?

It is shorter, and will make it slightly easier to remove all the Python 2 specific code one day.

Comment thread Tests/test_MarkovModel.py Outdated
state_list, state_float = states[0]
self.assertEqual(state_list, ["N"])

# Copyright 2017 by Maximilian Greil. All rights reserved.

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.

Just put a single (combined) copyright notice at the top of the file please.

Comment thread Tests/test_MarkovModel.py Outdated
self.assertTrue(
array_equal(around(
markov_model.p_emission, decimals=3),
around(output_p_emission, decimals=3)))

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 indentation of the first example is the most readable, with the two things being compared on their on lines (self contained).

Comment thread Tests/test_MarkovModel.py Outdated
matrix = array([[0., -1.5606477, -3.07477539, -3.84932984],
[-16.11809565, -2.4079455, -3.27544608, -4.5847794]])
self.assertTrue(
array_equal(around(MarkovModel._forward(len(states),

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.

As above, put the array_equal on the first line so that the two things being compared is clearer.

@peterjc

peterjc commented Apr 2, 2017

Copy link
Copy Markdown
Member

I don't know why the coverage report hasn't appeared on the pull request (yet), but this looks good. I've only spotted some minor style issues, and placement of copyright header.

MaxGreil added 3 commits April 2, 2017 20:12
Adjusted Tests/test_MarkovModel.py to suggestions by Peter Cock.
Fixed code according to pep8 standards.
Additional updates to Tests/test_MarkovModel.py to satisfy pep8 style guide
@MaxGreil

MaxGreil commented Apr 2, 2017

Copy link
Copy Markdown
Contributor Author

Hello Peter,
I corrected all your mentioned style issues and the placement of the copyright header.

@peterjc
peterjc merged commit 2aca8bb into biopython:master Apr 2, 2017
@peterjc

peterjc commented Apr 2, 2017

Copy link
Copy Markdown
Member

I filled in the missing copyright information with fd4f94a and dual-licensed it with 6b04713 (see #898).

Thanks for working on this Max :)

MarkusPiotrowski pushed a commit to MarkusPiotrowski/biopython that referenced this pull request Oct 31, 2017
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.

2 participants