Mercurial > repos > sanbi-uwc > confil
annotate test/test_report.py @ 4:eaf51f9aff10 draft
planemo upload for repository https://github.com/COMBAT-TB/confil commit 9e5284a2616de5d869319f9c4436716a3f6656f8-dirty
author | sanbi-uwc |
---|---|
date | Mon, 04 Mar 2019 03:28:57 -0500 |
parents | 53a61865e86e |
children |
rev | line source |
---|---|
3
53a61865e86e
planemo upload for repository https://github.com/COMBAT-TB/confil commit cb48efaef286f70c94607cb583a61bb9e3d71604
sanbi-uwc
parents:
diff
changeset
|
1 import os |
53a61865e86e
planemo upload for repository https://github.com/COMBAT-TB/confil commit cb48efaef286f70c94607cb583a61bb9e3d71604
sanbi-uwc
parents:
diff
changeset
|
2 |
53a61865e86e
planemo upload for repository https://github.com/COMBAT-TB/confil commit cb48efaef286f70c94607cb583a61bb9e3d71604
sanbi-uwc
parents:
diff
changeset
|
3 import pytest |
53a61865e86e
planemo upload for repository https://github.com/COMBAT-TB/confil commit cb48efaef286f70c94607cb583a61bb9e3d71604
sanbi-uwc
parents:
diff
changeset
|
4 |
53a61865e86e
planemo upload for repository https://github.com/COMBAT-TB/confil commit cb48efaef286f70c94607cb583a61bb9e3d71604
sanbi-uwc
parents:
diff
changeset
|
5 from confil.report import parse_report |
53a61865e86e
planemo upload for repository https://github.com/COMBAT-TB/confil commit cb48efaef286f70c94607cb583a61bb9e3d71604
sanbi-uwc
parents:
diff
changeset
|
6 from test_runner import TEST_DATA_DIR |
53a61865e86e
planemo upload for repository https://github.com/COMBAT-TB/confil commit cb48efaef286f70c94607cb583a61bb9e3d71604
sanbi-uwc
parents:
diff
changeset
|
7 |
53a61865e86e
planemo upload for repository https://github.com/COMBAT-TB/confil commit cb48efaef286f70c94607cb583a61bb9e3d71604
sanbi-uwc
parents:
diff
changeset
|
8 TEST_REPORT = os.path.join(TEST_DATA_DIR, "test_file.tab") |
53a61865e86e
planemo upload for repository https://github.com/COMBAT-TB/confil commit cb48efaef286f70c94607cb583a61bb9e3d71604
sanbi-uwc
parents:
diff
changeset
|
9 |
53a61865e86e
planemo upload for repository https://github.com/COMBAT-TB/confil commit cb48efaef286f70c94607cb583a61bb9e3d71604
sanbi-uwc
parents:
diff
changeset
|
10 # test using a cutoff of 50% |
53a61865e86e
planemo upload for repository https://github.com/COMBAT-TB/confil commit cb48efaef286f70c94607cb583a61bb9e3d71604
sanbi-uwc
parents:
diff
changeset
|
11 |
53a61865e86e
planemo upload for repository https://github.com/COMBAT-TB/confil commit cb48efaef286f70c94607cb583a61bb9e3d71604
sanbi-uwc
parents:
diff
changeset
|
12 |
53a61865e86e
planemo upload for repository https://github.com/COMBAT-TB/confil commit cb48efaef286f70c94607cb583a61bb9e3d71604
sanbi-uwc
parents:
diff
changeset
|
13 @pytest.mark.parametrize("test_input, expected", [ |
53a61865e86e
planemo upload for repository https://github.com/COMBAT-TB/confil commit cb48efaef286f70c94607cb583a61bb9e3d71604
sanbi-uwc
parents:
diff
changeset
|
14 (type(parse_report(TEST_REPORT, 50)), list), |
53a61865e86e
planemo upload for repository https://github.com/COMBAT-TB/confil commit cb48efaef286f70c94607cb583a61bb9e3d71604
sanbi-uwc
parents:
diff
changeset
|
15 (parse_report(TEST_REPORT, 50)[5], 'Mycobacterium'), |
53a61865e86e
planemo upload for repository https://github.com/COMBAT-TB/confil commit cb48efaef286f70c94607cb583a61bb9e3d71604
sanbi-uwc
parents:
diff
changeset
|
16 (parse_report(TEST_REPORT, 50)[0], '55.84') |
53a61865e86e
planemo upload for repository https://github.com/COMBAT-TB/confil commit cb48efaef286f70c94607cb583a61bb9e3d71604
sanbi-uwc
parents:
diff
changeset
|
17 ]) |
53a61865e86e
planemo upload for repository https://github.com/COMBAT-TB/confil commit cb48efaef286f70c94607cb583a61bb9e3d71604
sanbi-uwc
parents:
diff
changeset
|
18 def test_parse_report(test_input, expected): |
53a61865e86e
planemo upload for repository https://github.com/COMBAT-TB/confil commit cb48efaef286f70c94607cb583a61bb9e3d71604
sanbi-uwc
parents:
diff
changeset
|
19 assert test_input == expected |
53a61865e86e
planemo upload for repository https://github.com/COMBAT-TB/confil commit cb48efaef286f70c94607cb583a61bb9e3d71604
sanbi-uwc
parents:
diff
changeset
|
20 |
53a61865e86e
planemo upload for repository https://github.com/COMBAT-TB/confil commit cb48efaef286f70c94607cb583a61bb9e3d71604
sanbi-uwc
parents:
diff
changeset
|
21 |
53a61865e86e
planemo upload for repository https://github.com/COMBAT-TB/confil commit cb48efaef286f70c94607cb583a61bb9e3d71604
sanbi-uwc
parents:
diff
changeset
|
22 def test_parse_report_exception(): |
53a61865e86e
planemo upload for repository https://github.com/COMBAT-TB/confil commit cb48efaef286f70c94607cb583a61bb9e3d71604
sanbi-uwc
parents:
diff
changeset
|
23 with pytest.raises(SystemExit): |
53a61865e86e
planemo upload for repository https://github.com/COMBAT-TB/confil commit cb48efaef286f70c94607cb583a61bb9e3d71604
sanbi-uwc
parents:
diff
changeset
|
24 parse_report(TEST_REPORT, 90) |