From 0263a7c79e3131d42006a38ac2fbb80556506491 Mon Sep 17 00:00:00 2001 From: Muriithi Frederick Muriuki Date: Thu, 22 Jul 2021 13:58:18 +0300 Subject: Check that given list and both coordinates, we get shortest distance * gn3/computations/slink.py: Add code to compute the distance given the coordinate of both members on the parent list/tuple * tests/unit/computations/test_slink.py: * Change the name of the tests to more closely correspond to the business requirement the test is checking for * Update the comments to indicate some more things that might need to be done in the future --- tests/unit/computations/test_slink.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'tests/unit') diff --git a/tests/unit/computations/test_slink.py b/tests/unit/computations/test_slink.py index 6be3f33..166eff9 100644 --- a/tests/unit/computations/test_slink.py +++ b/tests/unit/computations/test_slink.py @@ -65,9 +65,10 @@ class TestSlink(TestCase): with self.assertRaises(ValueError, msg="Distances should be positive."): nearest(lst, 1, 1) - def test_nearest_with_expected(self): - # Give this test a better name - # The lists in this tests are taken from: + def test_nearest_returns_shortest_distance_given_coordinates_to_both_group_members(self): + # This test is named wrong - at least I think it is, from the expected results + # This tests distance when both `i`, and `j` are integers + # We still need to add tests for when (either one/both) (is/are) not (an) integer(s) # https://github.com/genenetwork/genenetwork1/blob/master/web/webqtl/heatmap/slink.py#L39-L40 for lst, i, j, expected in [[[[0,9,3,6,11],[9,0,7,5,10],[3,7,0,9,2],[6,5,9,0,8],[11,10,2,8,0]], 0,0,0], -- cgit v1.2.3