def test_votes_normalization(): ''' Tests if min-max normalization of votes works. Note that in a scale of 0-1 the value 0.775 has to be 0.5 (if the initial range is 0.55-1). ''' prot1 = core.Protein(symbol="PROTEIN'\"", positions=[1], sentence=core.Sentence("This is a sentence")) prot2 = core.Protein(symbol="PROTEIN2'\"", positions=[2], sentence=core.Sentence("This is a sentence")) int_candidate = core.InteractionCandidate(prot1, prot2) int_candidate.votes = 0.775 int_candidate._InteractionCandidate__normalize_pred() assert (0.5 == int_candidate.votes)
def test_disambiguate(): ''' Tests disambuation of protein symbols ''' prot = core.Protein(symbol="PROTEIN'\"", positions=[1], sentence=core.Sentence("This is a sentence")) assert (prot.disambiguate() == "PROTEIN")
def test_disambiguation_negative(): ''' Tests a incorrect disambiguation ''' protname = "tHISISNOTAKNOWNPROTEIn" protein = core.Protein(symbol=protname, positions=[1, 2], sentence="placeholder") disamb = protein.disambiguate() assert (disamb == "THISISNOTAKNOWNPROTEIN")
def test_disambiguation_positive(): ''' Tests a correct disambiguation ''' protname = "albumin" protein = core.Protein(symbol=protname, positions=[1, 2], sentence="placeholder") disamb = protein.disambiguate() assert (disamb == "ALB")