import unittest
from prostate27 import Prostate27


class runTest(unittest.TestCase):

    def test_nearest_neighbor(self):
        """
        nearest neighbors are found
        """
        p = Prostate27()
        self.assertIn('6a', p.nearest_neighbors('5a'))
        self.assertIn('11a', p.nearest_neighbors('15as'))
        self.assertIn('6a', p.nearest_neighbors('15as'))
        self.assertIn('5p', p.nearest_neighbors('11p'))

    def test_location(self):
        """
        indices corresponding to region
        """
        p = Prostate27()
        self.assertTrue(p.location('12a') == (2, 1, 3))
        self.assertTrue(p.location('1a') == (0, 1, 1))

    def test_nn_ranges(self):
        """
        27 region index bounds not exceeded; AS regions pull all mid-gland
        """
        p = Prostate27()
        self.assertTrue(p.nn_ranges((1, 2, 3)) ==
                        [[0, 1, 2], [1, 2], [2, 3]])
        self.assertTrue(p.nn_ranges((0, 0, 0)) ==
                        [[0, 1], [0, 1], [0, 1, 2, 3]])

    def test_anterior_posterior(self):
        """
        anterior / posterior assignment
        """
        p = Prostate27()
        self.assertTrue(p.anterior_posterior('14as') == 'anterior')
        self.assertTrue(p.anterior_posterior('1p') == 'posterior')
        self.assertTrue(p.anterior_posterior('5a') == 'anterior')


if __name__ == '__main__':
    unittest.main()

@@ -1353,16 +1353,377 @@
 rior')%0A%0A
+    def test_zone(self):%0A        %22%22%22%0A        peripheral zone / central gland assignment%0A        %22%22%22%0A        p = Prostate27()%0A        self.assertTrue(p.zone('9a') == 'central gland')%0A        self.assertTrue(p.zone('11a') == 'central gland')%0A        self.assertTrue(p.zone('4a') == 'peripheral zone')%0A        self.assertTrue(p.zone('14as') == 'peripheral zone')%0A%0A
 %0Aif __na

test peripheral zone / central gland assignment