-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding regression test for sample summary report
- Loading branch information
Jazz Mack Smith
committed
Jan 9, 2024
1 parent
2f59d52
commit b4425f0
Showing
2 changed files
with
64 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import os | ||
import sys | ||
import unittest | ||
|
||
sys.path.append("..") | ||
import nPYc | ||
|
||
""" | ||
Tests for checking specific data values remain the same after report functionality changes | ||
""" | ||
class test_sample_summary_regression(unittest.TestCase): | ||
|
||
def setUp(self): | ||
# load test data specific for this purpose: we know the correct numbers | ||
self.data = nPYc.MSDataset(os.path.join('..', '..', | ||
'npc-standard-project', | ||
'Regression_Testing_Data', | ||
'DEVSET U RPOS xcms_regressionTesting.csv'), | ||
fileType='XCMS', | ||
sop='GenericMS', | ||
noFeatureParams=9) | ||
|
||
self.data.addSampleInfo(descriptionFormat='Basic CSV', | ||
filePath=os.path.join('..', '..', | ||
'npc-standard-project', | ||
'Regression_Testing_Data', | ||
'DEVSET U RPOS Basic CSV_regressionTesting.csv')) | ||
|
||
def test_report_samplesummary(self): | ||
|
||
sampleSummary = nPYc.reports._generateSampleReport(self.data, returnOutput=True) | ||
|
||
# Check returns against expected | ||
|
||
# Acquired - Totals | ||
assert sampleSummary['Acquired'].loc['All', 'Total'] == 115 | ||
assert sampleSummary['Acquired'].loc['Study Sample', 'Total'] == 8 | ||
assert sampleSummary['Acquired'].loc['Study Reference', 'Total'] == 11 | ||
assert sampleSummary['Acquired'].loc['Long-Term Reference', 'Total'] == 1 | ||
assert sampleSummary['Acquired'].loc['Serial Dilution', 'Total'] == 92 | ||
assert sampleSummary['Acquired'].loc['Blank', 'Total'] == 2 | ||
assert sampleSummary['Acquired'].loc['Unknown', 'Total'] == 1 | ||
|
||
# Acquired - Marked for exclusion | ||
assert sampleSummary['Acquired'].loc['All', 'Marked for Exclusion'] == 1 | ||
assert sampleSummary['Acquired'].loc['Study Sample', 'Marked for Exclusion'] == 1 | ||
assert sampleSummary['Acquired'].loc['Study Reference', 'Marked for Exclusion'] == 0 | ||
assert sampleSummary['Acquired'].loc['Long-Term Reference', 'Marked for Exclusion'] == 0 | ||
assert sampleSummary['Acquired'].loc['Serial Dilution', 'Marked for Exclusion'] == 0 | ||
assert sampleSummary['Acquired'].loc['Blank', 'Marked for Exclusion'] == 0 | ||
assert sampleSummary['Acquired'].loc['Unknown', 'Marked for Exclusion'] == 0 | ||
|
||
# Check details tables | ||
assert sampleSummary['MarkedToExclude Details'].shape == (1, 2) | ||
assert sampleSummary['UnknownType Details'].shape == (1, 1) | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |
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