def test_single_element_start(self): diploid = MagicMock() diploid.starts = np.array([0], dtype = np.uint32) diploid.end = 10 diploid.founder = np.array([1], dtype = np.uint32) ret_diploid = new_sequence(diploid, ar([0])) self.assertEqual(ret_diploid.starts, [0]) self.assertEqual(ret_diploid.founder, [1])
def test_middle_boundary_two_element_multiple_breaks(self): diploid = MagicMock() diploid.starts = np.array([0, 10], dtype = np.uint32) diploid.end = 20 diploid.founder = np.array([1, 2], dtype = np.uint32) ret_diploid = new_sequence(diploid, [5, 15]) self.assertEqual(ret_diploid.starts, [0, 5, 10, 15]) self.assertEqual(ret_diploid.founder, [1, 1, 2, 2])
def test_single_element_end(self): diploid = MagicMock() diploid.starts = np.array([0], dtype = np.uint32) diploid.end = 10 diploid.founder = np.array([1], dtype = np.uint32) ret_diploid = new_sequence(diploid, [10]) self.assertEqual(ret_diploid.starts, [0]) self.assertEqual(ret_diploid.founder, [1])
def test_start_boundary_two_element(self): diploid = MagicMock() diploid.starts = np.array([0, 10], dtype = np.uint32) diploid.stops = np.array([10, 20], dtype = np.uint32) diploid.founder = np.array([1, 2], dtype = np.uint32) ret_diploid = new_sequence(diploid, [0]) self.assertEqual(ret_diploid.starts, [0, 10]) self.assertEqual(ret_diploid.founder, [1, 2])