Skip to content

Commit

Permalink
Added some qvalue error tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wfondrie committed Mar 19, 2021
1 parent 77f3c5f commit 3aa5865
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/unit_tests/test_qvalues.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,19 @@ def test_tdc_ascending(asc_scores):

qvals = tdc(scores, target.astype(dtype), desc=False)
np.testing.assert_array_equal(qvals, true_qvals)


def test_tdc_non_bool():
"""If targets is not boolean, should get a value errir"""
scores = np.array([1, 2, 3, 4, 5])
targets = np.array(["1", "0", "1", "0", "blarg"])
with pytest.raises(ValueError):
tdc(scores, targets)


def test_tdc_diff_len():
"""If the arrays are different lengths, should get a ValueError"""
scores = np.array([1, 2, 3, 4, 5])
targets = np.array([True] * 3 + [False] * 3)
with pytest.raises(ValueError):
tdc(scores, targets)

0 comments on commit 3aa5865

Please sign in to comment.