-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from UMCUGenetics/release/v1.10.0
v1.10.0
- Loading branch information
Showing
5 changed files
with
109 additions
and
24 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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
genologics==0.3.20 | ||
argparse==1.4.0 | ||
xmltodict==0.12.0 | ||
xmltodict==0.12.0 | ||
pytest==7.0.1 | ||
pytest-mock==3.6.1 |
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,59 @@ | ||
import sys | ||
|
||
from clarity_epp.export import sample | ||
|
||
|
||
class MyMock: | ||
def __init__(self, udf): | ||
self.udf = udf | ||
|
||
|
||
def test_sample_udf_withudf(mocker, capsys): | ||
# Test output for sample with known Dx-udf in database | ||
samples_mock[sample_name] = MyMock({"Dx geslacht": "Vrouw"}) | ||
patched_clarity_epp = mocker.patch( | ||
'clarity_epp.export.sample.get_samples', | ||
return_value=samples_mock | ||
) | ||
sample.sample_udf_dx("lims", sys.stdout, udf="Dx geslacht", column_name=column_name) | ||
captured = capsys.readouterr() | ||
assert captured.out == f"Sample\t{column_name}\n{sample_name}\tVrouw\n" | ||
|
||
|
||
def test_sample_udf_withoutudf(mocker, capsys): | ||
# Test output for sample with no known udf in database | ||
samples_mock[sample_name] = MyMock({"Dx geslacht": "Vrouw"}) | ||
patched_clarity_epp = mocker.patch( | ||
'clarity_epp.export.sample.get_samples', | ||
return_value=samples_mock | ||
) | ||
sample.sample_udf_dx("lims", sys.stdout, udf="udf2", column_name=column_name) | ||
captured = capsys.readouterr() | ||
assert captured.out == f"Sample\t{column_name}\n{sample_name}\tunknown\n" | ||
|
||
def test_sample_udf_withoutdxudf(mocker, capsys): | ||
# Test output for sample with known udf in database, but not Dx-udf | ||
samples_mock[sample_name] = MyMock({"Geslacht": "Vrouw"}) | ||
patched_clarity_epp = mocker.patch( | ||
'clarity_epp.export.sample.get_samples', | ||
return_value=samples_mock | ||
) | ||
sample.sample_udf_dx("lims", sys.stdout, udf="Geslacht", column_name=column_name) | ||
captured = capsys.readouterr() | ||
assert captured.out == f"Sample\t{column_name}\nWarning, udf is not type \'Dx\'\n" | ||
|
||
|
||
def test_sample_udf_nosamples(mocker, capsys): | ||
# Test output for sample not known in database | ||
samples_mock[sample_name] = MyMock({"Dx geslacht": "Vrouw"}) | ||
patched_clarity_epp = mocker.patch( | ||
'clarity_epp.export.sample.get_samples', | ||
return_value=None | ||
) | ||
sample.sample_udf_dx("lims", sys.stdout) | ||
captured = capsys.readouterr() | ||
assert captured.out == "no_sample_found\n" | ||
|
||
column_name = "test_column" | ||
sample_name = "test_sample" | ||
samples_mock = {} |