From 3aa5865feeebc43ee3a5e0d92de0860af307fb90 Mon Sep 17 00:00:00 2001 From: William Fondrie Date: Fri, 19 Mar 2021 16:53:44 -0700 Subject: [PATCH] Added some qvalue error tests --- tests/unit_tests/test_qvalues.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/unit_tests/test_qvalues.py b/tests/unit_tests/test_qvalues.py index 72050b0a..d3212c1e 100644 --- a/tests/unit_tests/test_qvalues.py +++ b/tests/unit_tests/test_qvalues.py @@ -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)