-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* plot incidence and tests * Change plotIncidence name to comply with PEP-8 PEP-8 naming convention for functions and class methods states that names should be in snake case (with underscore chars). So plotIncidence should be plot_incidence. Note that the former is used a lot amongst web developers (Flask apps, Django apps, ...) Co-authored-by: Matthias Roels <matthias.roels@pythonpredictions.com>
- Loading branch information
1 parent
8f442b4
commit 002bc57
Showing
4 changed files
with
109 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import pytest | ||
import pandas as pd | ||
from cobra.evaluation import plotIncidence | ||
|
||
|
||
def mock_data(): | ||
d = {'variable': ['education', 'education', 'education', 'education'], | ||
'label': ['1st-4th', '5th-6th', '7th-8th', '9th'], | ||
'pop_size': [0.002, 0.004, 0.009, 0.019], | ||
'avg_incidence': [0.23, 0.23, 0.23, 0.23], | ||
'incidence': [0.047, 0.0434, 0.054, 0.069]} | ||
return pd.DataFrame(d) | ||
|
||
|
||
class TestEvaluation: | ||
|
||
def test_plot_incidence(self): | ||
data = mock_data() | ||
column_order = ['1st-4th', '5th-6th', '7th-8th'] | ||
with pytest.raises(Exception): | ||
plotIncidence(data, 'education', column_order) |