Skip to content

Commit

Permalink
remove useless unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
CunliangGeng committed Jun 6, 2024
1 parent d3c70d7 commit 19a5801
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 33 deletions.
7 changes: 1 addition & 6 deletions tests/unit/scoring/test_metcalf_scoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,7 @@ def test_setup_load_cache(mc, npl):


def test_calc_score_raw_score(mc):
"""Test `calc_score` method for `raw_score_spec_gcf` and `raw_score_mf_gcf`.
The expected values are calculated manually by using values from `test_init`
of `test_data_links.py` and the default scoring weights.
"""
"""Test `calc_score` method for `raw_score_spec_gcf` and `raw_score_mf_gcf`."""
# link type = 'spec-gcf'
mc.calc_score(link_type="spec-gcf")
assert_frame_equal(
Expand Down Expand Up @@ -185,7 +181,6 @@ def test_get_links_gcf_standardised_false(mc, gcfs, spectra, mfs):
assert len(links) == 3
assert {i.gcf_id for i in links.keys()} == {"gcf1", "gcf2", "gcf3"}
assert isinstance(links[gcfs[0]][spectra[0]], ObjectLink)
# expected values are from `test_get_links_gcf` of test_link_finder.py
assert links[gcfs[0]][spectra[0]].data(mc) == 12
assert links[gcfs[1]][spectra[0]].data(mc) == -9
assert links[gcfs[2]][spectra[0]].data(mc) == 11
Expand Down
27 changes: 0 additions & 27 deletions tests/unit/scoring/test_nplinker_scoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
from nplinker.scoring import ObjectLink


pytestmark = pytest.mark.skip(reason="Skipping all tests in this file temporarily for dev")


def test_get_links_gcf_standardised_false(npl, mc, gcfs, spectra, mfs, strains_list):
"""Test `get_links` method when input is GCF objects and `standardised` is False."""
# test raw scores (no standardisation)
Expand All @@ -20,20 +17,12 @@ def test_get_links_gcf_standardised_false(npl, mc, gcfs, spectra, mfs, strains_l
assert len(links) == 3
assert {i.gcf_id for i in links.keys()} == {"gcf1", "gcf2", "gcf3"}
assert isinstance(links[gcfs[0]][spectra[0]], ObjectLink)
# expected values are from `test_get_links_gcf` of test_link_finder.py
assert links[gcfs[0]][spectra[0]].data(mc) == 12
assert links[gcfs[1]][spectra[0]].data(mc) == -9
assert links[gcfs[2]][spectra[0]].data(mc) == 11
assert links[gcfs[0]][mfs[0]].data(mc) == 12
assert links[gcfs[1]][mfs[1]].data(mc) == 12
assert links[gcfs[2]][mfs[2]].data(mc) == 21
# expected values are from `test_get_common_strains_spec` of test_data_links.py
assert links[gcfs[0]][spectra[0]].common_strains == [strains_list[0]]
assert links[gcfs[1]][spectra[0]].common_strains == []
assert links[gcfs[2]][spectra[0]].common_strains == [strains_list[0]]
assert links[gcfs[0]][mfs[0]].common_strains == [strains_list[0]]
assert links[gcfs[1]][mfs[1]].common_strains == [strains_list[1]]
assert set(links[gcfs[2]][mfs[2]].common_strains) == set(strains_list[0:2])

# when test cutoff is 0, i.e. taking scores >= 0
mc.cutoff = 0
Expand All @@ -49,12 +38,6 @@ def test_get_links_gcf_standardised_false(npl, mc, gcfs, spectra, mfs, strains_l
assert links[gcfs[0]][mfs[0]].data(mc) == 12
assert links[gcfs[1]][mfs[1]].data(mc) == 12
assert links[gcfs[2]][mfs[2]].data(mc) == 21
# test shared strains
assert links[gcfs[0]][spectra[0]].common_strains == [strains_list[0]]
assert links[gcfs[2]][spectra[0]].common_strains == [strains_list[0]]
assert links[gcfs[0]][mfs[0]].common_strains == [strains_list[0]]
assert links[gcfs[1]][mfs[1]].common_strains == [strains_list[1]]
assert set(links[gcfs[2]][mfs[2]].common_strains) == set(strains_list[0:2])


@pytest.mark.skip(reason="To add after refactoring relevant code.")
Expand All @@ -78,9 +61,6 @@ def test_get_links_spec_standardised_false(npl, mc, gcfs, spectra, strains_list)
assert links[spectra[0]][gcfs[0]].data(mc) == 12
assert links[spectra[0]][gcfs[1]].data(mc) == -9
assert links[spectra[0]][gcfs[2]].data(mc) == 11
assert links[spectra[0]][gcfs[0]].common_strains == [strains_list[0]]
assert links[spectra[0]][gcfs[1]].common_strains == []
assert links[spectra[0]][gcfs[2]].common_strains == [strains_list[0]]

mc.cutoff = 0
links = npl.get_links(list(spectra), mc, and_mode=True)
Expand All @@ -92,8 +72,6 @@ def test_get_links_spec_standardised_false(npl, mc, gcfs, spectra, strains_list)
assert links[spectra[0]][gcfs[0]].data(mc) == 12
assert links[spectra[0]].get(gcfs[1]) is None
assert links[spectra[0]][gcfs[2]].data(mc) == 11
assert links[spectra[0]][gcfs[0]].common_strains == [strains_list[0]]
assert links[spectra[0]][gcfs[2]].common_strains == [strains_list[0]]


@pytest.mark.skip(reason="To add after refactoring relevant code.")
Expand All @@ -117,9 +95,6 @@ def test_get_links_mf_standardised_false(npl, mc, gcfs, mfs, strains_list):
assert links[mfs[0]][gcfs[0]].data(mc) == 12
assert links[mfs[0]][gcfs[1]].data(mc) == -9
assert links[mfs[0]][gcfs[2]].data(mc) == 11
assert links[mfs[0]][gcfs[0]].common_strains == [strains_list[0]]
assert links[mfs[0]][gcfs[1]].common_strains == []
assert links[mfs[0]][gcfs[2]].common_strains == [strains_list[0]]

mc.cutoff = 0
links = npl.get_links(list(mfs), mc, and_mode=True)
Expand All @@ -131,8 +106,6 @@ def test_get_links_mf_standardised_false(npl, mc, gcfs, mfs, strains_list):
assert links[mfs[0]][gcfs[0]].data(mc) == 12
assert links[mfs[0]].get(gcfs[1]) is None
assert links[mfs[0]][gcfs[2]].data(mc) == 11
assert links[mfs[0]][gcfs[0]].common_strains == [strains_list[0]]
assert links[mfs[0]][gcfs[2]].common_strains == [strains_list[0]]


@pytest.mark.skip(reason="To add after refactoring relevant code.")
Expand Down

0 comments on commit 19a5801

Please sign in to comment.